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

Unable to push via ssh

Илья May 2, 2022

Hello everyone!

I have a permanent error on git push command via ssh: 

Unauthorized
fatal: Could not read from remote repository.

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

And it makes me crazy (

So, given:

  1. Generated ssh keys (public and private) on the local repository side.
  2. Public key added to "Access keys" settings of my private bitbucket repository.
  3. ssh -T git@bitbucket.org command gives successful message:
    authenticated via ssh key.
    You can use git to connect to Bitbucket. Shell access is disabled
  4. BUT git push command gives "unauthorized" error!

I've been through tons of discussions and tried following:

  1. Transfer key from repo settings to the account settings. But then git push gives another error: 
    fatal: unable to create thread: Resource temporarily unavailable
    error: failed to push some refs to 'git@bitbucket.org:<user>/<proj>.git'
  2. Create .ssh/config file and put there:
    Host bitbucket.org
    IdentityFile ~/.ssh/id_rsa
    IPQoS=throughput
    No effect.
  3. Regenerate keys. No effect.

I've spent 2 days with it and I don't have any more ideas where is the problem.

Help me please!

 

2 answers

1 accepted

0 votes
Answer accepted
Mohamed Adel
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.
May 2, 2022

Hi @Илья  

I wonder if you tried the following solution in this Can't git push to Bitbucket: Unauthorized - fatal: Could not read from remote repository 

Regards,

Mohamed Adel

Илья May 3, 2022

Yes, I;ve tried it. I've pointed it in my question:

I've been through tons of discussions and tried following:

1. Transfer key from repo settings to the account settings. But then git push gives another error: 

fatal: unable to create thread: Resource temporarily unavailable
error: failed to push some refs to 'git@bitbucket.org:<user>/<proj>.git

As a result I get another error "resource unavailable". (

Mohamed Adel
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.
May 3, 2022
Илья May 4, 2022

Hmm... Missed this thread for some reason. )
Thank you a lot!

After following that hints I'd got the next problem: "failed to push some refs to remote". And I'd solve it with this thread: https://stackoverflow.com/questions/24114676/git-error-failed-to-push-some-refs-to-remote (recreate repository with named "master" instead "main" by default)

Like Mohamed Adel likes this
0 votes
Илья May 2, 2022

ssh -v git@bitbucket.org gives the following:

OpenSSH_7.4p1, OpenSSL 1.0.2k-fips 26 Jan 2017
debug1: Reading configuration data /home/ilexaru/.ssh/config
debug1: /home/ilexaru/.ssh/config line 1: Applying options for bitbucket.org
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 58: Applying options for *
debug1: Connecting to bitbucket.org [104.192.141.1] port 22.
debug1: Connection established.
debug1: identity file /home/ilexaru/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /home/ilexaru/.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_bb796ffc5d fdf5fd4970f6
debug1: no match: conker_bb796ffc5d fdf5fd4970f6
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: rsa-sha2-512
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: curve25519-sha256@libssh.org need=64 dh_need=64
debug1: kex: curve25519-sha256@libssh.org need=64 dh_need=64
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 /home/ilexaru/.ssh/known_hosts:1
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-rsa-cert-v01@openssh.com,ssh-dss-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-rsa,rsa-sha2-256,ecdsa-sha2-nistp256>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/ilexaru/.ssh/id_rsa
debug1: Server accepts key: pkalg rsa-sha2-512 blen 279
debug1: Authentication succeeded (publickey).
Authenticated to bitbucket.org ([104.192.141.1]:22).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: pledge: network
debug1: Sending environment.
PTY allocation request failed on channel 0
authenticated via ssh key.

You can use git to connect to Bitbucket. Shell access is disabled
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: channel 0: free: client-session, nchannels 1
Connection to bitbucket.org closed.
Transferred: sent 3052, received 2168 bytes, in 0.3 seconds
Bytes per second: sent 11877.9, received 8437.5
debug1: Exit status 0

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events