Yves Calaci
Yves Calaci

Reputation: 1129

Can't operate GitHub repository using SSH

I'm trying certain git operations, such as pull, push etc but none works: Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.

Things I have done:

  1. Checked whether the remotes were ssh's: git remote -v

    origin [email protected]:USERNAME/REPOSITORY.git (fetch)

    origin [email protected]:USERNAME/REPOSITORY.git (push)

  2. Checked if the ssh agent is running: eval "$(ssh-agent -s)"

    Agent pid 123456

  3. Added the private key to ssh agent: ssh-add "path_to_private_key_file"

    Identity added: "path_to_private_key_file" ([email protected])

  4. Added the public key to Github at "https://github.com/settings/ssh/new"

  5. Checked whether ssh connection is working: ssh -T [email protected]

    Hi USERNAME! You've successfully authenticated, but GitHub does not provide shell access.

enter image description here

Upvotes: 1

Views: 926

Answers (1)

VonC
VonC

Reputation: 1323793

Assuming that:

  • you don't have an environment variable GIT_SSH
  • your %PATH% references C:\Program Files\Git\usr\bin\ssh.exe first

Make sure that:

  • your remote origin URL is [email protected]:me/myRepo
  • you have a %USERNAME%\.ssh\config file which set a the right private key file path, assuming it is not the default one (id_rsa).

That config file would be (again, only if the private key is nont the default one):

Host github.com
  Hostname github.com
  User git
  IdentityFile C:\path\to\private\key\file

Upvotes: 0

Related Questions