Git is a great way to manage different versions of your code during development. I use it on my local machine when developing on my own but occasionally need to start working with others. This is a step-by-step description of how to upload a local git repository to github.com for sharing and collaborating.
Fill in the details required and make sure the README and .gitignore boxes are not ticked.
Checkout my list of useful git commands - suggestions for new commands are keenly sought!
I am assuming that we are starting with git repository having a number of commits and branches that you created and have used on your local machine. I'm also assuming that all commits have been made and all have been merged back on to the master branch. I describe how to do all of this in my post Intro to Git Version Control.
Step 1: Sign-up for a github.com account and log-in
A github account is free if you don't mind your code being publicly accessible. There are charges if you want a private space for your code currently starting at $7 per month.
Step 2: Create new github repository
Click on your username to go to your homepage and click on the new repository button on the repository tab.
Fill in the details required and make sure the README and .gitignore boxes are not ticked.
Step 3: Push the local repository to github.com
Github helpfully give you the instructions to do this - run the following commands in your local command line while in the repositories root directory:
mattmapleston$ git remote add origin git@github.com:username/repositoryname.git mattmapleston$ git push -u origin master Counting objects: 60, done. Delta compression using up to 4 threads. Compressing objects: 100% (51/51), done. Writing objects: 100% (60/60), 8.21 MiB | 105 KiB/s, done. Total 60 (delta 19), reused 0 (delta 0) To git@github.com:workingmatt/milan.git * [new branch] master -> master Branch master set up to track remote branch master from origin.
And that's it you're fully synced with github and can share your code and collaborate with anyone. Job done!
Checkout my list of useful git commands - suggestions for new commands are keenly sought!
No comments:
Post a Comment