User Tools

Site Tools


git pull via ssh public key

If using for example 'myuser' user but with a custom ssh key name i.e. myuser_github and not id_rsa you will get an error if trying to run the following command:

myuser@host:~/my-user$ git clone .  
Cloning into '.'...
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Fix this by editing .ssh/config to this:

	User git
    	IdentityFile ~/.ssh/myuser_github

Use different host

You can use a custom hostname as well, e.g.

Host github-someorg
    	IdentityFile ~/.ssh/myuser_github

Then to clone use that host

git clone git@github-someorg:someuser/repo.git

Tested on

See also


wiki/git_pull_via_ssh_public_key.txt · Last modified: 2024/01/30 11:50 by antisa

Except where otherwise noted, content on this wiki is licensed under the following license: CC0 1.0 Universal
CC0 1.0 Universal Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki