Here is how you can upload a file to your Github repository using Git Bash.
Before you can start, you need to:
- Understand the basics of Gits
- Have created a repository on Github
- Have cloned the repository locally.
To sync a file from your local folder to your remote Github repository:
- Move your file to the cloned repository
- Open Git Bash
- Go to the current directory where you want the cloned directory to be added.
cdand add your folder location. You can add the folder location by dragging the folder to Git bash.
$ cd '/c/Users/j-c.chouinard/My First Git Project'
- Add the file and stage it for commit
$ git add 'yourFileName.py‘
- Commit the file to your local repository
$ git commit -m 'yourFileName.py‘
- Push the changes to Github
$ git push origin master
For simplicity, I considered that you have not built work branches and that you commit straight to the master branch.
After all of this, you file will be committed to your Github repository.
To learn more about Git Commands, check out this Git Cheatsheet.