Forums/Using Cloud9 IDE/Frequently asked questions

How do I push my Cloud9 project to GitHub

Daniela Gavidia
posted this on April 16, 2012 11:45

It all depends on how you created your project. First, have you linked your Cloud9 account with your GitHub account? You can check that by going to the Dashboard and seeing if it is activated under Add-on Services (you can see how to link your GitHub account here).
Now, if the Cloud9 account and the GitHub account are linked, you can just create a new repository in GitHub and then just clone from url in Cloud9 (choose Clone from url in the Dashboard). This will create a project in Cloud9 that is already linked to the repository on GitHub, so you should be able to go to the console and just do a 'git push' to update the GitHub repo. 

Alternatively, you can create the Cloud9 project first (by going to the Dashboard and choosing Create a New Project). The new Cloud9 project is not yet linked to a GitHub repo. The next step is to go to GitHub and create a repo for your project. Then, follow the instructions on GitHub (we also have some instructions in the README.md file included in any new Cloud9 project). In short (in the Cloud9 console): 

  • Add a git remote in the Cloud9 console. Should look like this (replace the git url with your repo url): 

git remote add origin git@github.com:C9Support/testPush.git 

  • Add files and commit them:

git add . 

git commit -m "First commit"

  • Push to github: 

git push -u origin master

Personally, I prefer to create a repo on GitHub first, clone it and then I just add, commit and push files to GitHub. However, if you created the project in Cloud9 first, you just need to create a matching repo for it on GitHub and add a remote on the console. From that point on, the procedure is the same. 

 

Comments

User photo
Martin Richards

I signed up using my github account, and created a project on cloud9 and then tried to commit to github (i.e., the alternative way) but when I try push my changes I get the following error:

[martinffx@cloud9]:/workspace$ git push -u origin master
Warning: Permanently added 'github.com,207.97.227.239' (RSA) to the list of known hosts.
Warning: Permanently added 'github.com,207.97.227.239' (RSA) to the list of known hosts.
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
How do you add your cloud9 public key to github?
May 23, 2012 12:12
User photo
Jonathan Sewell

You can find your SSH key on your Cloud 9 Dashboard, on the right of the screen under "Account Settings". Copy that and paste it into a new SSH entry on your GitHub account at https://github.com/settings/ssh.

May 27, 2012 23:36
User photo
Gunnlaugur Einarsson

I was able to clone a repo from github.

But when trying to push to github an error occurs "WARNING: UNPROTECTED PRIVATE KEY FILE!"

How can I fix this?

June 28, 2012 02:56
User photo
Calvin Metcalf

I get the same issue 

June 28, 2012 20:41
User photo
TeckniX

Same issue while trying to push code to github after creating the project in C9 then doing a git init with the console.

Verified that the SSH key from C9 is in my github and that it's pulling the github projects (show as active on dashboard). 

When clicking the Github icon on the dashboard (although active) it shows: Error: Assigning a wrong UID to this session

When trying to push I get: error: The requested URL returned error: 403 while accessing

Seems that the wrong keys are being used?

 

*Some updates may be coming through, as during this comment the dashboard went completely offline with no server response

June 29, 2012 16:11
User photo
Calvin Metcalf

Solved!

I opened up my project on a computer running Ubuntu and was able to push fine there. After that I was able to push on the windows xp computer. 

June 29, 2012 16:17
User photo
TeckniX

Calvin,

The issue is not pushing from a remote computer, but rather pushing from C9 directly

June 29, 2012 16:50
User photo
Calvin Metcalf

TechniX,

To clarify after pushing from within c9 on the Ubuntu computer and then I was able to push from within c9 on the Windows XP computer

June 29, 2012 16:53
User photo
TeckniX

Lucky you - I'm still getting: 

Error: Assigning a wrong UID to this session
From the dashboard when 'checking the active status of GitHub' then from my C9 project console:
error: The requested URL returned error: 403 while accessing https://github.com....
June 29, 2012 17:01
User photo
Kevin Logan

I'm getting the same error:

/workspace$ git push -u origin master

error: The requested URL returned error: 403 while accessing https://github.com/
fatal: HTTP request failed
I'm connected to git hub through the dashboard and I was able to commit, but I'm unable to push.
July 13, 2012 17:48
User photo
Allan Moreno

I was getting same error when using HTTP URL to clone the repo, but it just worked like charm when cloning the repo from SSH URL.

July 15, 2012 08:36
User photo
TeckniX

I confirmed that updating the url to use the SSH version instead of https version worked. Both should really be supported though.

If you already had the 'origin' remote declared for your project, you can simply update its url by running the following:

git remote set-url origin <new-url>

eg: git remote set-url origin git@github.com:MyGitUserName/c9.git

July 16, 2012 16:06
User photo
James McMahon

I am getting this error when try this process, error: cannot run $HOME/bin/ssh: No such file or directory.

I get this using the clone from github method (see attached screenshot) or creating the cloud 9 project first.

What is going on here?

August 21, 2012 20:16
User photo
James McMahon

Follow up to my last commit. When I closed the workspaces and refreshed my dashboard page everything worked as expected.

Cloud 9 seems to have a lot of these issues.

August 21, 2012 20:27
User photo
Fred Mitchell
I guess it would be nice to have instructions that start at the beginning and occur in the proper order to actually work!

Of course, that assumes you don't find all the others that don't do that.

error: The requested URL returned error: 403 Forbidden while accessing https://github.com/fm75/fm-1.git/info/refs                                                                                                
                                                                                                                                                                                                                 
fatal: HTTP request failed 
April 25, 2013 01:05
User photo
TeckniX

@Fred Mitchell - Not sure what instructions you're missing, but they are exactly as Github describes them when you first created your github project.

The url to your git should btw be: https://github.com/fm75/fm-1.git not https://github.com/fm75/fm-1.git/info/refs

git clone https://github.com/fm75/fm-1.git

Sometimes using the ssh version works better:

git clone git@github.com:fm75/fm-1.git

 

One of the big things is to make sure that your keys are properly in github provided by c9, or that you linked your account, if you need to push back to it.

If not you wont be able to read AND write

April 25, 2013 03:30