6

I'm having issues connecting to a Bitbucket repository using SSH. I have the public and private keys set up correctly. I'm worried that the issue is due to the fact that I"m working on a Windows 10 machine. Does anyone know how to get around the following error:

*setsockopt IPV6_TCLASS 8: Operation not permitted: repository access denied. deployment key is not associated with the requested repository. fatal: Could not read from remote repository .

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

I know I am in the repository. I can check out different branches in the repository and commands such as "git add" and "git commit" appear to work, however, "git push" is failing due to the above mentioned error.

Thank you

Robert
  • 183
  • 2
  • 13

2 Answers2

8

Make sure to use the latest Git for Windows (2.19.1) and, as I mentioned here, try a git push -4 ...

That will force the use of IPV4, to check if that would work better.

As detailed in this thread:

For me it's an IPv6 issue.
BitBucket doesn't respond to IPv6 ssh requests, so you have to wait for it to timeout.
I fixed it by adding:

AddressFamily inet

to /etc/ssh/ssh_config and git pull responds within seconds not minutes.

The last part is only valid if you are using an SSH URL, and for git pull, but might still have an effect for git push.


As noted by xpt in the comments, WSL issue 1869 says it OK to put AddressFamily inet into ~/.ssh/config, but I've just tried it, and it was not working for me, until I put it into /etc/ssh/ssh_config instead.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Just a note that, https://github.com/microsoft/WSL/issues/1869 says it OK to put `AddressFamily inet` into `~/.ssh/config`, but I've just tried it, and it was not working for me, until I put it into `/etc/ssh/ssh_config` instead. – xpt Aug 18 '22 at 14:53
  • 1
    @xpt Thank you for this feedback. I have included your comment in the answer for more visibility. – VonC Aug 18 '22 at 19:29
2

Thank you everyone for your help. There were two issues causing this.

First, the IPV6 warning itself was resolved once I upgraded from git version 2.7.4 to 2.19.1.

After making this adjustment I still saw an error "Permission denied (publickey)..."

I resolved this error by moving the private key, id_rsa, to the following location: /c/Users//.ssh/

Everything seems to be in order now.

Robert
  • 183
  • 2
  • 13