git: login with deploy key
Generate a new ssh key:
ssh-keygen -t ed25519 -C "git@simpel.cc"
Name it like "id_github_server".
Adding your ssh key to the ssh-agent:
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_github_server
Prepare ssh config:
vim ~/.ssh/config
Host github.com
Hostname github.com
User git
AddKeysToAgent yes
IgnoreUnknown UseKeychain
UseKeychain yes
IdentityFile ~/.ssh/id_github_server
Copy the ssh public key to your clipboard:
pbcopy < ~/.ssh/id_github_server.pub
Go to GitHub > Setting > Deploy keys and create e.g. "simpel.cc" and paste public key.
Make local repo ready for key use.
vim .git/config
Add to [core]:
sshCommand = "ssh -i ~/.ssh/id_github_server"
git config core.sshCommand "ssh -i ~/.ssh/id_github_mbax"
If [remote "origin]" is called by https change to ssh:
url = git@github.com:SimpelMe/REPO.git
You get this git-url with help of Code-(Clone)-Button > SSH on github.
No comments to display
No comments to display