I enjoy the Cloud9 IDE, but their “How do I push my Cloud9 project to GitHub” support article is, when pushing existing code to a new repository, pretty much entirely unhelpful.
If you take the time to read down to the comments you’ll eventually figure out the right way to do it, but it’ll take a while. Here’s the run down:
- In the bottom left of your C9 dashboard is a section called “Add-on Services”. Click “activate” next to the “GitHub” icon (if you haven’t already).
- When the pop up appears, tell it to allow access to your account. This should complete the link between GitHub account and your C9 account.
- While still on the dashboard, look to the right under “Account Settings” for the link “Show your SSH key”. Click on it, and copy the value which appears.
- Go to the GitHub SSH settings page, and click “Add SSH Key”
- Enter the title “C9”, paste the SSH Key into the “Key” box, and click “Add Key”.
- Create a new, empty repository for your project.From your repository’s home page, copy the SSH link. By default GitHub shows the HTTPS link, you will need to toggle it to ssh first!It will look something like:
- Open your C9 project window, and go to the terminal.Set your git config username:
git config --global user.name "Your Name Here"
- Set your git config email (which should match your github account email):
git config --global user.email "email@example.com"
- Make your current directory a git repository by running:
- Using the SSH link you copied in step 7, add the remote repository as the origin:
git remote add origin firstname.lastname@example.org:yourname/yourrepository.git
- Add your files and commits, as you normally would:
git add .
git commit -m "First commit"
- Push your changes:
git push -u origin master
- Admire your updated repository on GitHub
So yes, there’s a bit of mucking around. The alternative is, of course, that you create the empty repository on GitHub first, then create a new C9 project using the “check out new project” functionality. In future, I think I’ll probably try that method instead.