Lost permission to repo that I had access to 5 days ago

So I created a new repo 5 days ago. I proceeded to clone it, make some changes, and push it as usual. Nothing went wrong. Today, when I made more changes and tried to push, I got the error "Permission denied (publickey)."

I made sure my ssh key matched the one I had on bitbucket. 

I made sure the key was added to my ssh agent. 

I tried disconnecting and reconnecting to origin master.

I tried cloning (same error).

I tried recreating my ssh key (adding it to bitbucket and ssh agent again).

I tried running ssh -T git@bitbucket.org:username. It said: "logged in as username. you can use git or hg to connect to bitbucket. Shell access is disabled."

When I run ssh -V git@bitbucket.org I get: 

OpenSSH_7.5p1, OpenSSL 1.0.2l 25 May 2017
debug1: Reading configuration data /c/Users/mmsch/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to bitbucket.org [104.192.143.3] port 22.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/mmsch/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/mmsch/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/mmsch/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/mmsch/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/mmsch/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/mmsch/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/mmsch/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/mmsch/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.5
debug1: Remote protocol version 2.0, remote software version conker_1.0.311-c6337e4 app-129
debug1: no match: conker_1.0.311-c6337e4 app-129
debug1: Authenticating to bitbucket.org:22 as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256@libssh.org
debug1: kex: host key algorithm: ssh-rsa
debug1: kex: server->client cipher: aes128-ctr MAC: hmac-sha2-256-etm@openssh.com compression: none
debug1: kex: client->server cipher: aes128-ctr MAC: hmac-sha2-256-etm@openssh.com compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-rsa SHA256:zzXQOXSRBEiUtuE8AikJYKwbHaxvSc0ojez9YXaGp1A
debug1: Host 'bitbucket.org' is known and matches the RSA host key.
debug1: Found key in /c/Users/mmsch/.ssh/known_hosts:1
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /c/Users/mmsch/.ssh/id_rsa
debug1: Trying private key: /c/Users/mmsch/.ssh/id_dsa
debug1: Trying private key: /c/Users/mmsch/.ssh/id_ecdsa
debug1: Trying private key: /c/Users/mmsch/.ssh/id_ed25519
debug1: No more authentication methods to try.
Permission denied (publickey).

It says the publickey can continue. Does this mean my private key is failing?

 

Side note: I use 2 keys. One for bitbucket and one for github. This is my config:

Host bitbucket.org:username
HostName bitbucket.org
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa_one

Host github.com:username2
HostName github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa_two

 

Also, when I first pushed today, it said it added my IP address again. Not sure if that's of importance. 

1 answer

0 vote

Hi, I would like to confirm that I have been had the same issue in past two months. I'm on macOS 10.13.
When I create the keys all works fine first day but the next day I don't have an access to my repos on bitbacket. Unfortunately I have not found solution to this problem. I have to recreate the keys every day. It's really annoying. I would grateful for any advice or help.

Suggest an answer

Log in or Join to answer
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

692 views 0 4
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot