Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,294,801
Community Members
 
Community Events
165
Community Groups

Publickey stopped working on one repository

Edited

This evening I pushed some commits to a repo using SourceTree, which worked just fine. A short time later, I tried pushing some more and suddenly the publickey decided not to work, asking for a password and then telling me that passwords were now disabled. If I check with ssh -T, it assures me that the key is just fine, and if I try pushing something to another repo, that works also, so it's nothing to do with the key itself. I tried restarting SourceTree, which prompted for my master key as expected, but it still refused to push to the repo. I tried the WSL command line and that also failed. I tried TortoiseGit and that failed, but again, just for the one repository.

I was helping one of my colleagues a few days ago who had a similar problem, and it mysteriously started working again for him after a while, but I've not been lucky with that yet.

I just tried a pull from the repository and it won't let me do that either, but once again, other repos are just fine.

I can view the repository and its files on the web just fine.

Edit to add: it's some sort of local repository corruption. I was able to clone the repository  to a new directory OK, copy the modified files from the previous one, commit and push.

1 answer

1 accepted

0 votes
Answer accepted

I seem to have figured out a solution, even though I don't know why it broke, but in case it helps someone else, this is what appears to have happened:

Go look at the git config (.git/config) file and under remote origin, it will have 

url = https://....
fetch = +refs/heads/*:refs/remotes/origin/*

and no mention of an ssh key. 

What you need there is 

url = git@bitbucket.org:...
fetch = +refs/heads/*:refs/remotes/origin/*
puttykeyfile = ...

The quickest way to fix it seems to be to clone the repository to somewhere else and copy over the config file from the new one to the old one, or at least copy the remote section.

Another variation reported by a colleague appears to be where the url is correct but the line defining the key file is missing.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

Git push size limits are coming to Bitbucket Cloud starting April 4th, 2022

Beginning on April 4th, we will be implementing push limits. This means that your push cannot be completed if it is over 3.5 GB. If you do attempt to complete a push that is over 3.5 GB, it will fail...

2,160 views 2 9
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you