I am trying to learn and understand basics of github. For the purpose, I created some files.
- try_catch_basics.py
- reading_from_files.py and countries.txt
- writing_in_files.py and country.txt
Now, I had created a repository earlier with name try-catch-basics, and included the first file in it. I wanted to include my second and third files in the new repository that I created, but I am not able to do that. Here are the steps that I followed for the same -
View -> Command Palette -> Git: Add Remote ->https://github.com/SteelTitan247/File-handling-in-python -> Gave a name -> and pressed enter.
Then, I clicked source control and commited with a message. Now, an option is showing me for sync changes.
When I am clicking on it, it is showing me this -
which is the previously created repo for my file 1. How do I "shift" or change repo from this to my new one?
For reference, this is the older repo -
Click on upload existing files and drop your files in next window
Enter your commit message and click on commit changes
Now you have files in your repository! now clone your repository from vs code and start working with git
CodePudding user response:
I usually use the GitHub application itself, in it, to upload my files to another repository, I would first have to sync the repository and then move or copy the files to the chosen folder. After that perform the commit and pull
CodePudding user response:
You can use source tree tool and clone git repo in your project and than you can add/[commit,push] your files
You can drag and drop files manually for very first time in main branch and than clone your repository in new location and than ready to go!
In vs code first clone your repository and than push your files. Open your local project.
3.1 VSCode source control interface showing Open Folder and CLone Repository
3.2 Add a README.md file (If you don't have anything else to add yet)
3.3 VSCode explorer interface showing README.md
3.4 Click on Publish on Github
3.5 VSCode source control interface showing Initialize Repository and Clone to GitHub
3.6 Choose whether you want your repo to be private or public
3.7 Interface showing choice between private and public repos
3.6 Choose the files you want to include in first commit.
Note: If you don't select a file or folder it will added to .gitignore file
Showing interface where you choose which files to include in the repo
You are good to go. it is published.
P.S. If this was your first time a prompt will ask for for your Github Credentials. Fill those in and you are good to go. It is published.
For more Information : How to add a new project to Github using VS Code