Skip to content

Instantly share code, notes, and snippets.

@hasantahir
Last active August 3, 2016 04:50
Show Gist options
  • Save hasantahir/c528feddce8ac5721132f7c2db471752 to your computer and use it in GitHub Desktop.
Save hasantahir/c528feddce8ac5721132f7c2db471752 to your computer and use it in GitHub Desktop.
Git procedure to upload to a Github Repo
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