Skip to content

Instantly share code, notes, and snippets.

@jokandre
Last active January 22, 2017 09:02
Show Gist options
  • Select an option

  • Save jokandre/6f8fcab38fa4b3346ba364f6a030e0df to your computer and use it in GitHub Desktop.

Select an option

Save jokandre/6f8fcab38fa4b3346ba364f6a030e0df to your computer and use it in GitHub Desktop.
Set up SSH connection on Github

Generating a new SSH key

$ ssh-keygen -t rsa -b 4096 -C "[email protected]"
Generating public/private rsa key pair.
Enter passphrase (empty for no passphrase): [Type a passphrase]
Enter same passphrase again: [Type passphrase again]
  • Adding your SSH key to the ssh-agent
$ eval "$(ssh-agent -s)"
Agent pid 59566
  • Add your SSH key to the ssh-agent.
$ ssh-add ~/.ssh/id_rsa

Switching remote URLs from SSH to HTTPS

  • If you're updating to use SSH, your URL might look like:
[email protected]:USERNAME/OTHERREPOSITORY.git
  • If you're updating to use HTTPS, your URL might look like:
https://github.com/USERNAME/OTHERREPOSITORY.git
  • List your existing remotes in order to get the name of the remote you want to change.
$ git remote -v
origin  [email protected]:USERNAME/REPOSITORY.git (fetch)
origin  [email protected]:USERNAME/REPOSITORY.git (push)

Change your remote's URL from SSH to HTTPS with the git remote set-url command.

$ git remote set-url origin [URL]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment