Cannot push to Git repository on Bitbucket

后端 未结 21 665
春和景丽
春和景丽 2020-11-29 14:40

I created a new repository and I\'m running into a strange error. I\'ve used Git before on Bitbucket but I just reformatted and now I can\'t seem to get Git to work. After

相关标签:
21条回答
  • 2020-11-29 15:41

    I am using macOS and although i had setup my public key in bitbucket the next time i tried to push i got

    repository access denied.

    fatal: Could not read from remote repository.

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

    What i had to do was Step 2. Add the key to the ssh-agent as described in Bitbucket SSH keys setup guide and especially the 3rd step:

    (macOS only) So that your computer remembers your password each time it restarts, open (or create) the ~/.ssh/config file and add these lines to the file:

    Host *
    UseKeychain yes

    Hope it helps a mac user with the same issue.

    0 讨论(0)
  • 2020-11-29 15:42

    This might not be the case for everyone but I still make an answer here in case someone is having the same cause. Basically I have two Bitbucket accounts, each have two different public keys. By running ssh -Tv bitbucket.org I managed to see that my laptop is sending incorrect key (but since both public keys are registered in bitbucket, the key is still approved, then since the key is linked to another account which does not have access to the repo I'm pushing, the push is rejected).

    So I followed this guide and my issue is gone: https://blog.developer.atlassian.com/different-ssh-keys-multiple-bitbucket-accounts/

    0 讨论(0)
  • 2020-11-29 15:42

    I found the git command line didnt fancy my pageant generated keys (Windows 10).

    See my answer on Serverfault

    0 讨论(0)
提交回复
热议问题