Last active
November 14, 2024 16:47
-
-
Save agritheory/4422bd0abc61f873360eb3e164046a93 to your computer and use it in GitHub Desktop.
Add deploy key
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# on local machine generate public and private keys | |
ssh-keygen -t ed25519 | |
$ Generating public/private ed25519 key pair. | |
$ Enter file in which to save the key (/home/tyler/.ssh/id_ed25519): deploy_key | |
# add deploy_key.pub to github deploy keys via UI | |
# add both keys to server | |
# modify permissions | |
chmod 700 ~/.ssh | |
chmod 600 ~/.ssh/deploy_key | |
chmod 644 ~/.ssh/deploy_key.pub | |
# test connection to github | |
ssh -i "~/.ssh/deploy_key" [email protected] | |
# change from https to ssh | |
git remote set-url upstream ssh://[email protected]:user/repo.git | |
# add config to ~/.ssh/config | |
Host github.com | |
HostName github.com | |
User git | |
IdentityFile ~/.ssh/deploy_key | |
IdentitiesOnly yes | |
# to configure a second private repo: | |
Host primary.github.com | |
HostName github.com | |
User git | |
IdentityFile ~/.ssh/deploy_key | |
IdentitiesOnly yes | |
Host secondary.github.com | |
HostName github.com | |
User git | |
IdentityFile ~/.ssh/secondary_deploy | |
IdentitiesOnly yes |
~/.ssh/authorized_keys
and ~/.ssh/config
should both have 700 permissions: chmod 700 authorized_keys
@agritheory I had to modify this a bit to get it to work. After adding the keys, chmod, and successful authentication, I ran:
bench get-app --branch [branch-name] [app-name] [email protected]:username/repository.git
or if using an organization:
bench get-app --branch [branch-name] [app-name] [email protected]:organization/repository.git
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Git clone: