-
-
Save rbialek/1012262 to your computer and use it in GitHub Desktop.
Host github.com | |
User git | |
Hostname github.com | |
PreferredAuthentications publickey | |
IdentityFile /home/user/.ssh/id_rsa |
I add StrictHostKeyChecking no just for github.com. to avoid the messages like Warning: Permanently added the RSA host key for IP address '140.82.113.3' to the list of known hosts., as GitHub has many servers that get added to known_hosts.
Do NOT do this, I've never experienced this warning with github as they use a single hostkey as they should. If you get this warning after the connection it is a sign that you're connection is or was intercepted.
@hunterjackson You must be using an RSA key. I was using a ECDSA key and now a Ed25519 key. From my understanding these types of keys have only recently had a single hostkey for all servers.
@franmadj I write a naive tool about it. see https://github.com/alingse/git-ssh-key
just run
pip install git-ssh-key
# this will change repo link to an alias link
git-ssh-key https://github.com/alingse/git-ssh-key.git
So the same key is used for all my repositories? I think it is not possible.
How can specify a key for a repository?
Thanks.
Host github.com-repo-0
Hostname github.com
IdentityFile=/home/user/.ssh/repo-0_deploy_key
Host github.com-repo-1
Hostname github.com
IdentityFile=/home/user/.ssh/repo-1_deploy_key
Thanks a lot ! after 7 hours trying to clone my repository finally found the solution
Thnx
FYI: I landed here after the config on this GitHub help page didn't work (maybe its the wildcard or that you need a HostName
field as well?). I also added the following to avoid having to enter my password every time:
UseKeychain yes
AddKeysToAgent yes
I also added the following to avoid having to enter my password every time:
UseKeychain yes AddKeysToAgent yes
Just note that UseKeychain yes
is Mac only, AddKeysToAgent
works on Linux.
I also use the following, this will tell SSH to not try every identity file within that folder, but only the one’s defined.
IdentitiesOnly yes
On windows, using the following config file... I'm still prompted for the passphrase each time :( Any ideas?
Host github.com
HostName github.com
User cefect
IdentityFile ~/.ssh/is_ed
AddKeysToAgent yes
IdentitiesOnly yes
#UseKeychain yes #mac only
@cefect
Maybe check if you have an SSH agent working and running.
Also check if your ssh key is loaded in the agent ssh-add -L
@cefect Check if you have added a SSH key on GitHub website under your profile. https://github.com/settings/keys. If so, make sure you are using the SSH URL when making the connection to origin. Should be [email protected] instead of https://github.com
Thanks @wsdookadr, keys are added:
\
Thanks @LarsPeterson,
key added to profile:
not sure what you mean by 'using the SSH URL when making the connection to origin', maybe this?
note I'm only trying to get rid of the key passphrase prompt (the ssh keys are working in that I don't have to enter username and password each time... just passphrase)
Oh whoops just read your comment again. You need to generate a new key and skip the passphrase part. Just don't enter anything. Then go through the whole process again, add to profile, etc.
thanks for that!
This sort of configuration appears to be required if you want to use PHPStorm to clone from VCS via WSL.
ssh-add {rsa_file}
It works.
@rohitchormale, you're genius!!!
@rohitchormale thank you!
@rohitchormale thanks!
I add
StrictHostKeyChecking no
just for github.com. to avoid the messages likeWarning: Permanently added the RSA host key for IP address '140.82.113.3' to the list of known hosts.
, as GitHub has many servers that get added toknown_hosts
.