Bitbucket access keys can only be used for read-on

2020-02-12 17:53发布

问题:

First time using bitbucket, trying to make a first push of my local project to bitbucket.

I managed to create a repository with no issues. After I created a new SSH Key, which I loaded to both Bitbucket and also Pagent (that is running in my windows background).

Still when I try to push my commit to Bitbucket I get the following:

git -c diff.mnemonicprefix=false -c core.quotepath=false push -v --tags --set-upstream origin master:master
Pushing to user@bitbucket.user/repository.git
repository access denied. access via a deployment key is read-only.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
Completed with errors, see above.

On Bitbucket -> Project -> Settings -> Access Keys: It says here, copying and pasting as it is:

Use access keys to gain read-only access to this repository. Learn more about using SSH keys.

Does this mean I can not use SSH Keys to make a push to the repository?
PS: I tried all the solutions that were available to sort out this issue, still I get the same error (regenerated the keys, tried both SourceTree or GitShell to make the push, still same error coming up); any other ideas are welcomed

Thanks

回答1:

I managed to finally make a push through git shell, by creating a new key where you specified (Acc->Security->SSH Keys); still does not seem to want to work with SourceTree

Check if SourceTree is configured to use the embedded git or the system Git (the latter being the one you have installed. And make sure your SourceTree runs with your account.

The OP Marin adds in the comments:

I managed to do all that in the end after setting a new ssh key for the account not the project and adding it to Pagent.

I managed to sort the issue quite quickly after the initial commit and push through Git Shell, I just checked out the repository using SourceTree and it worked (also my account was already linked to SourceTree)



回答2:

Try checking if your ssh-agent is working:

ssh-add -l

If you get error just do:

eval `ssh-agent -s` ssh-add ssh-add -l