Skip to content

Instantly share code, notes, and snippets.

@juemura
Last active September 12, 2023 09:40
Show Gist options
  • Save juemura/899241d73cf719de7f540fc68071bd7d to your computer and use it in GitHub Desktop.
Save juemura/899241d73cf719de7f540fc68071bd7d to your computer and use it in GitHub Desktop.
Tutorial: How to connect your Cloud9 and GitHub accounts via ssh

#Tutorial: How to connect your Cloud9 and GitHub accounts via ssh

To avoid having to enter your username and password EVERY-SINGLE-TIME you push, follow these step-by-step instructions.


#####1. Copy your C9 ssh key. Go to https://c9.io/account/ssh and copy the key below *"Connect to your private git repository"*. It's a very long string that starts with ssh-rsa and ends with your email.

#####2. Paste your C9 ssh key into your GitHub account Go to https://github.com/settings/keys and click New SSH key. Enter a title (a name like Cloud9 is fine), paste the ssh key that you copied in the previous step, and click Add SSH key

#####3. When creating a remote, make sure you "clone with SSH" instead of "clone with HTTPS" This means that, when you type in git remote add origin, you should use a link that looks like this: *git@github.com:*YOUR_USER_NAME/YOUR_REPO_NAME.git. Pay attention to how that differs from *https://github.com/*YOUR_USER_NAME/YOUR_REPO_NAME.git While the first creates a remote that uses ssh authentication, the latter uses https, so it'll always prompt you to enter your username and password to authenticate the connection.


That's it! Next time you push anything, it should authenticate automatically, and you'll never again have to enter your credentials on C9.
@TannerHarman
Copy link

TannerHarman commented Jan 31, 2018

Thank you Madam! This is amazing.

@tchilov
Copy link

tchilov commented Feb 28, 2018

Thanks a lot for this guide!

I had to tinker around a little and add the protocol in front of the link (ssh://git@github.com/YOUR_USER_NAME/YOUR_REPO_NAME.git), but other than that, it works perfectly fine!

@echeverriac1
Copy link

i am trying to put my ssh key in Gitlab but show me this error "Fingerprint has already been taken", I generated other ssh key and solve it but when I open C9 other day change the last ssh key.... Can you help me?

@HuangStanley050
Copy link

thank you so much!

@gamalielvj
Copy link

Thanks a lot for the tips.

@Gaff
Copy link

Gaff commented May 9, 2020

Does this still work? This URL just takes me to a landing page: https://c9.io/account/ssh

@ademidun
Copy link

@Gaff (and people finding this page via Google) I think this info is out of date now but I found this tutorial that might be helpful: https://medium.com/sonabstudios/setting-up-github-on-aws-cloud9-with-ssh-2545c4f989ea

@Gaff
Copy link

Gaff commented May 14, 2020

@Gaff (and people finding this page via Google) I think this info is out of date now but I found this tutorial that might be helpful: https://medium.com/sonabstudios/setting-up-github-on-aws-cloud9-with-ssh-2545c4f989ea

Yeah - I'm guessing this information was pre the Cloud9 buyout from Amazon. Problem with that other solution is that the settings get destroyed whenever you re-create the host. I guess the alternative is to run your own AMI over ssh, or zap in the settings from some s3 or some secret store - but it's all a bunch of extra work to be done.

@ademidun
Copy link

the settings get destroyed whenever you re-create the host.

define "recreate the host", I logged out and logged back in and there were no issues (though did have to retype my SSH key passphrase) ,

@Gaff
Copy link

Gaff commented May 17, 2020

If the EC2 instance gets deatroyed (ratehr than just shutdown / restart). This might happen if you decide to upgrade your environment to give it more cpu / memory, or of you decide you don't want to pay storage fees while you are away on holiday or whatever.

@bijit85
Copy link

bijit85 commented Apr 21, 2021

Thank you. This was really helpful.

@zachliu
Copy link

zachliu commented Jun 17, 2022

@brycepaquette
Copy link

Thank you!!! still works except the cloud9 link doesn't bring me to the right place FYI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment