0

I am facing some issue while trying to use Git on my computer. I am using bit bucket to host my remote repository. The issue I have is when I'm trying to pull commit from bitbucket, I got the following error:

Permission denied (publickey).
fatal: Could not read from remote repository.

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

From what I understand, I don't have the rights to access the repository. So far, this is correct. Based on the article found at this link*, I am able to generate (with Git Bash) a new ssh key and add it to my ssh-agent. I am also able to add it to bitbucket. Then, as long as the Git Bash console stay open, I am able to pull or push on the remote repository. However, if I close Git Bash and open it again, I need to add it to the ssh-agent again. Furthermore, I can perform this operation on "cmder" (which is the console I'm using on Windows), which is sad.

Is there a way to add a ssh key in the ssh-agent one and for all and I will be always able to access it from any console ?

Thank you,

Ps: As a work-around, I am currently using Git Kraken, since it seems to use his own way to handle ssh key rather than relying on the ssh-agent, but I would like to be able to use a console to perform some operation that don't work well on git kraken.

*https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/,

David Lefaivre
  • 191
  • 3
  • 14
  • 1
    Unfortunately, Windows doesn't support `ssh` out of the box, like Unix operating systems. If you wish to use standard SSH, Windows themselves recommend [Putty](https://technet.microsoft.com/en-us/library/hh225041(v=sc.12).aspx). For git stuff, I use [SourceTree](https://www.sourcetreeapp.com/) unlike Git Kraken, its free. – Prav Dec 13 '17 at 22:35

2 Answers2

0

Not sure why this work, but adding the file "config" in the directory C:/Users/MY_NAME/.ssh/ (this is the directory were my ssh key for gitKraken is located) with the following setting did the trick:

#user1 account
    Host <HOST_NAME>
    HostName <HOST_NAME>
    User <USER_ID>
    IdentityFile ~/.ssh/gitkraken_rsa
David Lefaivre
  • 191
  • 3
  • 14
-1

I just ran into this the other day. There are two places that you need to add public keys. The first place is your main account ssh key. Click on your avatar and go into settings. The second place is your project "access key". This is usually a "read only" key that allow third parties to access that repo. Set this in the settings under "access key" for your specific repo.

Make sure you have both keys set up correctly.

fat fantasma
  • 7,483
  • 15
  • 48
  • 66