Skip to content

Instantly share code, notes, and snippets.

@pablohdzvizcarra
Forked from xirixiz/Set up GitHub push with SSH keys.md
Created November 9, 2020 02:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pablohdzvizcarra/4e847c0c08db986cf044166d92f36446 to your computer and use it in GitHub Desktop.
Save pablohdzvizcarra/4e847c0c08db986cf044166d92f36446 to your computer and use it in GitHub Desktop.
Set up GitHub push with SSH keys

Create a repo. Make sure there is at least one file in it (even just the README) Generate ssh key:

ssh-keygen -t rsa -C "your_email@example.com"

Copy the contents of the file ~/.ssh/id_rsa.pub to your SSH keys in your GitHub account settings. Test SSH key:

ssh -T git@github.com
clone the repo:
git clone git://github.com/username/your-repository

Now cd to your git clone folder and do:

git remote set-url origin git@github.com:username/your-repository.git

Now try editing a file (try the README) and then do:

git add -A
git commit -am "my update msg"
git push
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment