Skip to content

Instantly share code, notes, and snippets.

@jbutko
Last active March 17, 2022 09:21
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 jbutko/b20a12c62b506737db82ff96f6449bb2 to your computer and use it in GitHub Desktop.
Save jbutko/b20a12c62b506737db82ff96f6449bb2 to your computer and use it in GitHub Desktop.
Github - use of github deploy keys

1. Generate ssh key ssh-keygen -f ~/.ssh/project_x_id_rsa -t rsa -b 4096 -C "{email}"

2. Add public key to "deploy keys" in github

3. Verify connection: sudo ssh -T git@github.com

4. Edit ssh config file:

  • Edit ssh config file if you use multiple repos on server: sudo nano ~/.ssh/config and add these lines:
Host github.com-project-x
Hostname github.com
IdentityFile=~/.ssh/project_x_id_rsa

5. Clone the repo with custom host: git clone git@github.com-project-x:user/project-x.git .

6. All good.

sources:

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