I have followed all steps to create remote repo ,Created SSH keys pair, and also been succed to clone repo locally .To day after , now , created some folders and done staging +commit .
Now I cant be able to push :
$ git push origin master
Enter passphrase for key '/home/devuser/.ssh/bitbucket':
Unauthorized
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I inserted also in .ssh/config file :
Host bitbucket.org
AddKeysToAgent yes
IdentityFile ~/.ssh/{ssh-key-name}
It's is strange because all git read operations works and test work fine
$ ssh -T git@bitbucket.org
Enter passphrase for key '/home/devuser/.ssh/bitbucket':
authenticated via ssh key.
You can use git to connect to Bitbucket. Shell access is disabled
Then where is the problem ? please , help :)
Hello @Francesco Savino ,
Welcome to Atlassian Community!
As you mentioned that read operations (clone, pull) work and the issue happens only with write operations (push), I suspect you might have added the SSH key as an Access key.
SSH keys added as Repository or project access keys provide just read access to repositories. So you will be able to only clone and pull using a repo/project access key. The only access key that provides read and write access are Workspace Access keys (see Difference between repository, project and Workspace access keys ).
If you want the key to have the same access to repositories as your user account does, then you need to add the key to your user profile by going to Your avatar in the top right > Personal Settings > SSH keys.
It's important to note that you cannot use the same key both as access keys and personal keys.
With that in mind, could you please confirm if the key you are using was added as an access key at the repo or project level? If yes, you can then try either adding it as a personal key or as a workspace access key.
Thank you, @Francesco Savino !
Patrik S
Hi @Patrik S ,
It seems that I have a similar problem. I changed the computer and added a second SSH key, which I created new on my second laptop.
ssh-keygen -t rsa -b 2048 "gerXX.XXX@gmail.com" -f id_bitbucket
Then I added the SSH key to my account (Personal Settings > SSH keys).
The test is working:
$ ssh -T git@bitbucket.org
authenticated via ssh key.
You can use git to connect to Bitbucket. Shell access is disabled
I still get
> git pull --tags origin master
Unauthorized
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Thank you for your help!
Kind regards,
Gernot
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @gh_inet ,
I suspect the new key you created is not being used by SSH. To confirm if that is the case, could you please create a file named config inside the folder ~/.ssh/ and add the following content to it :
Host bitbucket.org
AddKeysToAgent yes
IdentityFile ~/.ssh/{name of your SSH key}
The IdentityFile section should contain the full path to the new key you created. This will force SSH to use the provided key when authenticating requests to bitbucket.org.
You can also try using the verbose flags in the git command so it will output logs containing more details about the ssh keys that were found in your local machine and the order they are being used :
GIT_TRACE_PACKET=1 GIT_TRACE=1 GIT_SSH_COMMAND="ssh -vvv" git pull --tags origin master
Thank you, @gh_inet !
Patrik S
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @kuno vaik ,
I would like to ask if you could please create a new question for your issue, providing details on the errors you see and also the output of the git command with the verbose log flags as mentioned above.
We generally encourage users to create a new question for their issue instead of posting on someone else’s question, because
1) the root cause and resolution may be different for each case
2) a question can become cluttered and difficult to follow if we try to troubleshoot multiple users’ issues in it.
Please feel free to let me know if you have any questions.
Thank you, @kuno vaik !
Patrik S
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.