This is step 2 in your journey toward rock-solid scientific Python code.
So you have your code under version control. Nice. But it’s sitting there on your computer. How do you share it with somebody else? And if they improve it, how do you incorporate their changes?
Version control is your first tool in this regard, too. Your second tool is Github (or Bitbucket, Google Code, etc.). Github is a website that will keep a backup copy of your code for free, and will allow others to download it, change it, and send you their changes. If that sounds great, read on. If you’re scared to put your code in the open because somebody might read it, ponder on this and then read on.
Two minutes to open code
- Go to Github and create an account.
- Once you’re logged in, click on the “+” in the upper-right part of the screen and select “New repository”.
- Give it the same name as your project, and write a short description.
- Don’t initialize it with a README or license file (we’ll do that in Step #3).
- Preferably, select “public” repository.
Github will take you to a screen with different sets of instructions. Choose that one that says “…or push an existing repository from the command line” and type what is shown there into a terminal (in your project directory):
cd /my/project/directory git remote add origin [email protected]:username/projectname.git git push -u origin master
Tada! You’ve just “pushed” your code to Github where it is made available to all the world! As a bonus, you can sleep soundly knowing that if your office floods and your house burns down tomorrow, your code will still be there waiting for you. The result should look something like my demo.
To learn more about using Github, take a few minutes to read the Software Carpentry lesson.
Now go on to step three.