Locked lesson.
About this lesson
Quick reference
Backup Your Code Using Github.com
Github.com allows us to save our version controlled code on a third party website for safe keeping.
When to use
Any time you make significant changes to your code, you should save it using version control and git. Since git sits on your local development environment, it's a good idea to push your code to a third party for safe keeping in case your local environment ever crashes. We'll use github for that.
Instructions
Sign up for a free account at GitHub.com
Next, copy your local ssh key by issuing this command in the terminal:
- cat /c/Users/flatplanet/.ssh/id_rsa.pub (replace flatplanet with the directory where you created your SSH keys earlier)
Copy and paste the whole block of text from the terminal, then log into your github.com account and click the "setting" icon in the top right corner of the screen. Next, click the "SSH and GPG keys" link on the left side of the screen. Finally, click the "New SSH Key" button at the top of the screen.
Name your key anything you like, then paste the ssh key into the text box provided. Click the "Add SSH Key" button to save your key.
Next; we need to create a new repository. Click the "Your Profile" link at the top right of the screen. Next, click the "Repositories" link at the top of the screen, then the "New" button.
Name the repository anything you like (pinteresting), and click "Public" then click the "Create Repository" button.
Github.com will provide you with two commands to enter into your git bash terminal, that should look like this:
- git remote add origin git@github.com:username/ProjectName.git
- git push -u origin master
From then on, whenever you want to push code to github.com use these three commands from the terminal:
- git add .
- git commit -am 'commit message'
- git push
Hints & tips
- Github.com is completely free.
- Once you connect to github.com once, you can push code from then on with the "git push" command.
- You don't need to log into github.com every time you write code.
Lesson notes are only available for subscribers.