Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

repository access denied

mheavers December 29, 2014

Hi - I am getting the following error now to a repo I used to be able to push to:

```

Pushing to git@bitbucket.org:digitalpulp/cornell.git
conq: repository access denied.
fatal: Could not read from remote repository.

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

````

 

I even created a separate public key for bitbucket vs git, which didn't fix the issue. This is my .ssh/config:

```

# Default GitHub user

Host github.com
HostName github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa

# Bitbucket
Host bitbucket.org
HostName bitbucket.org
PreferredAuthentications publickey
IdentityFile ~/.ssh/bitbucket

```

I followed all of the instructions here:

https://confluence.atlassian.com/pages/viewpage.action?pageId=271943168&continue=https%3A%2F%2Fconfluence.atlassian.com%2Fpages%2Fviewpage.action%3FpageId%3D271943168&application=cac

 

And added my public keys to the repo.

 

I ran:

```

ssh -Tv git@bitbucket.org.

````

This was the output:

````

OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /Users/[USER]/.ssh/config
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: Connecting to bitbucket.org [131.103.20.167] port 22.
debug1: Connection established.
debug1: identity file /Users/[USER]/.ssh/bitbucket type 1
debug1: identity file /Users/[USER]/.ssh/bitbucket-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.2
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH_5*
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: RSA 97:8c:1b:f2:6f:14:6b:5c:3b:ec:aa:46:46:74:7c:40
debug1: Host 'bitbucket.org' is known and matches the RSA host key.
debug1: Found key in /Users/[USER]/.ssh/known_hosts:13
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/[USER]/.ssh/bitbucket
debug1: Remote: Forced command: conq username:[USER]
debug1: Remote: Port forwarding disabled.
debug1: Remote: X11 forwarding disabled.
debug1: Remote: Agent forwarding disabled.
debug1: Remote: Pty allocation disabled.
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: Remote: Forced command: conq username:[USER]
debug1: Remote: Port forwarding disabled.
debug1: Remote: X11 forwarding disabled.
debug1: Remote: Agent forwarding disabled.
debug1: Remote: Pty allocation disabled.
debug1: Authentication succeeded (publickey).
Authenticated to bitbucket.org ([131.103.20.167]:22).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
logged in as [USER].

 

Any ideas what to try next? Pushing to this repo used to work for me...

6 answers

5 votes
tokoiwesley September 10, 2018

In the url, replace git with your bitbucket.org username. For example;

url = git@bitbucket.org:digitalpulp/cornell.git

 becomes

 url = digitalpulp@bitbucket.org:digitalpulp/cornell.git

That should solve the problem if you are the repository owner. If not, you also need to be given read/write permissions by the repository admin or owner.

vektor-barnaby November 15, 2018

Yes this worked, Paul Kleimeyer's answer above did not for some reason?

Thanks!

vektor-barnaby November 15, 2018

I also had to add this to my .profile

eval `ssh-agent -s`

ssh-add

ssh-add ~/.ssh/other-key
matthewsohswg June 1, 2019

@tokoiwesley  Thanks for the tip. 

When did this change happen? 

I am pulling from the same repo on 2 different machines. One works with the git username, the other doesn't. The one that does not work is on a more recent git build. Is that related?

 

Thanks
   Matt

tokoiwesley June 2, 2019

The one that does not work is on a more recent git build. Is that related?

@matthewsohswg I suppose.

Lately, on a new machine I cloned my repos successfully without having to replace git with my bitbucket.org username in the url.

When did this change happen? 

I first encountered this issue around the time I posted my workaround.

matthewsohswg June 2, 2019

Thanks Wesley. I posted this question to support. If I hear back, I'll update this thread. Glad to have found your workaround, I wasted a day debugging this until I stumbled upon your solution.

1 vote
Paul Kleimeyer April 22, 2018

Better late than never, I suppose...

In the .git/config file of your working folder, change

    url = git@bitbucket.org:digitalpulp/cornell.git

to

    url = bitbucket.org:digitalpulp/cornell.git

In other words, everything before the colon must exactly match a 'Host' in your ~/.ssh/config

neofreko September 12, 2018

Holy macaroo! It works! Thank you!

 

Originally it was intermittent failure. And then today, complete failure.

Why bitbucket change the original behaviour? Why even the clone instruction still includes `git@`?

Like vektor-barnaby likes this
0 votes
Jonathan Kieliszak September 16, 2017

I have the same issue.  Did you manage to resolve it?

Here's my output for "ssh git@bitbucket.org -Tv"

ssh git@bitbucket.org -Tv
OpenSSH_7.4p1, LibreSSL 2.5.0
debug1: Reading configuration data /Users/jbkielis/.ssh/config
debug1: /Users/jbkielis/.ssh/config line 156: Applying options for bitbucket.org
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to bitbucket.org [2401:1d80:1010::152] port 22.
debug1: Connection established.
debug1: identity file /Users/jbkielis/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/jbkielis/.ssh/id_rsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.4
debug1: Remote protocol version 2.0, remote software version conker_1.0.310-c404db1 app-155
debug1: no match: conker_1.0.310-c404db1 app-155
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 /Users/jbkielis/.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: Offering RSA public key: /Users/jbkielis/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: Authentication succeeded (publickey).
Authenticated to bitbucket.org ([2401:1d80:1010::152]:22).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: pledge: network
debug1: channel 0: free: client-session, nchannels 1
Transferred: sent 2712, received 1608 bytes, in 10.1 seconds
Bytes per second: sent 269.7, received 159.9
debug1: Exit status -1
0 votes
John Garcia
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 14, 2015

What's the output of {{ssh git@bitbucket.org -Tv}} ?

0 votes
Seth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 29, 2014

FYI, git != github

0 votes
Boris Berenberg
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 29, 2014

Do you have access to the repo via the WebUI?

andkuzmich August 9, 2017

I have same issue: ssh verbose shows that

debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: Authentication succeeded (publickey).
Authenticated to bitbucket.org ([IP]:22).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: pledge: network
debug1: Sending environment.
debug1: Sending env LC_TIME = uk_UA.UTF-8
debug1: Sending env LC_MONETARY = uk_UA.UTF-8
debug1: Sending env LC_ADDRESS = uk_UA.UTF-8
debug1: Sending env LC_TELEPHONE = uk_UA.UTF-8
debug1: Sending env LANG = en_US.UTF-8
debug1: Sending env LC_NAME = uk_UA.UTF-8
debug1: Sending env LC_MEASUREMENT = uk_UA.UTF-8
debug1: Sending env LC_IDENTIFICATION = uk_UA.UTF-8
debug1: Sending env LC_NUMERIC = uk_UA.UTF-8
debug1: Sending env LC_PAPER = uk_UA.UTF-8
debug1: Sending command: git-upload-pack '[user/repo.git]'
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
repository access denied.
debug1: channel 0: free: client-session, nchannels 1
debug1: fd 0 clearing O_NONBLOCK
debug1: fd 1 clearing O_NONBLOCK
Transferred: sent 3240, received 1648 bytes, in 0.3 seconds
Bytes per second: sent 10179.2, received 5177.6
debug1: Exit status 1
fatal: Could not read from remote repository.

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

Im the owner of that repo, and this log obtained while I tried to pull. And yes, I have access through web.  

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events