Locked lesson.
About this lesson
Quick reference
BitBucket For Version Control
BitBucket.org allows us to save our version controlled code on a third party website for safe keeping.
When to use
Normally I suggest Github.com, but if you want to keep your code private Bitbucket.org offers free private repositories. Github.com makes you pay for private repositories.
Instructions
Sign up for a free account at BitBucket.org
Next, copy your C9 ssh key by issuing this command in the terminal:
- cat ~/.ssh/id_rsa.pub
Copy and paste the whole block of text from the terminal, then log into your BitBucket.org account and click the "BitBucket settings" icon in the top right corner of the screen. Next, click the "SSH Keys" link on the left side of the screen.
Click the "Add Key" button at the top of the screen. Type in a name you like in the "Label" field, then paste your SSH key into the "Key" field. Click the "Add Key" button to save.
Next we need to create a new repository and link it to our C9 account. Click the "Repositories" link at the top of the screen, and then "Create Repository".
Name it anything you like, I suggest Pinteresting. Then click the "Create Repository" button.
Next scroll down to the bottom of the page and click the "I have an existing project" link. This will give us the two commands we'll need to connect our BitBucket repository to our C9 account.
Copy and paste the two commands listed into your C9 terminal:
- git remote add origin ssh://git@bitbucket.org/username/reponame.git
- git push -u origin master
Finally, to push your code to bitbucket from now on, issue these three commands from the C9 terminal:
- git add .
- git commit -am "Commit Message"
- git push
Hints & tips
- Bitbucket.org offers free private code repositories
- Once you connect to BitBucket.org once, you can push code from then on with the "git push" command
- You don't need to log into BitBucket.org every time you write code
Lesson notes are only available for subscribers.