Last active
August 3, 2016 04:50
-
-
Save hasantahir/c528feddce8ac5721132f7c2db471752 to your computer and use it in GitHub Desktop.
Git procedure to upload to a Github Repo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
First of all, initialize a git repo on the local machine by typing: | |
>>git init | |
in the git command prompt under the working directory. | |
In order to add the files one can use the command | |
>> git add . | |
The . ensures all files in the directory become part of the repo | |
At this time one can leave a commit message keeping track of the changes made in the repo | |
>> git commit -m "A message" | |
Now that the repo is locally set, we can sync it with a remote repo on github | |
>> git remote add origin https://github.com/user/repo.git | |
Where https://github.com/user/repo.git is the url of the repo on Github. | |
Once a remote is added, we can verify the sync by: | |
>> git remote -v | |
Finally push the local repo to remote Github by: | |
>> git push origin master | |
!! Pushing may not work for the first time. We can force-push the first time and it will be set from then on. Add -f flag to force push | |
>> git push -f origin master | |
A good source available on Github to do so: | |
https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment