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

After following the steps to add a SSH key, git push does not work

Juan Mendez November 25, 2022

I have tried adding the SSH key by project, by account.

I was able to do a git clone of a private repository, but the git push does not work.
It seems it can't find the repository. 

Doing this produces the following output.

 GIT_SSH_COMMAND="ssh -v" git push


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: filesystem full
debug1: Sending environment.
debug1: channel 0: setting env LC_CTYPE = "UTF-8"
debug1: Sending command: git-receive-pack 'myuser/myrepo.git'
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
The requested repository either does not exist or you do not have access. If you believe this repository exists and you have access, make sure you're authenticated.

 
Any hint?

2 answers

0 votes
Juan Mendez November 28, 2022

Thanks a lot for the answer @Syahrul

the thing is that it seems I am authenticated.  Excerpt of the logs using your recommended environment variables to debug.

Notice that I have edited my user and repo for privacy

debug1: Authentication succeeded (publickey).
Authenticated to bitbucket.org ([104.192.141.1]:22).
debug2: fd 6 setting O_NONBLOCK
debug2: fd 7 setting O_NONBLOCK
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug3: send packet: type 90
debug1: Entering interactive session.
debug1: pledge: filesystem full
debug3: receive packet: type 91
debug2: channel_input_open_confirmation: channel 0: callback start
debug2: fd 5 setting TCP_NODELAY
debug3: set_sock_tos: set socket 5 IP_TOS 0x20
debug2: client_session2_setup: id 0
debug1: Sending environment.
debug1: channel 0: setting env LC_CTYPE = "UTF-8"
debug2: channel 0: request env confirm 0
debug3: send packet: type 98
debug3: Ignored env _
debug1: Sending command: git-receive-pack 'myuser/myrepo.git'
debug2: channel 0: request exec confirm 1
debug3: send packet: type 98
debug2: channel_input_open_confirmation: channel 0: callback done
debug2: channel 0: open confirm rwindow 2097152 rmax 32768
debug3: receive packet: type 99
debug2: channel_input_status_confirm: type 99 id 0
debug2: exec request accepted on channel 0
debug2: channel 0: rcvd ext data 165
debug3: receive packet: type 98
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug3: receive packet: type 96
debug2: channel 0: rcvd eof
debug2: channel 0: output open -> drain
debug3: receive packet: type 97
debug2: channel 0: rcvd close
debug2: chan_shutdown_read: channel 0: (i0 o1 sock -1 wfd 6 efd 8 [write])
debug2: channel 0: input open -> closed
debug3: channel 0: will not send data after close
debug2: channel 0: obuf_empty delayed efd 8/(165)

The requested repository either does not exist or you do not have access. If you believe this repository exists and you have access, make sure you're authenticated.

debug2: channel 0: written 165 to efd 8
debug3: channel 0: will not send data after close
debug2: channel 0: obuf empty
debug2: chan_shutdown_write: channel 0: (i3 o1 sock -1 wfd 7 efd 8 [write])
debug2: channel 0: output drain -> closed
debug2: channel 0: almost dead
debug2: channel 0: gc: notify user
debug2: channel 0: gc: user detached
debug2: channel 0: send close
debug3: send packet: type 97
debug2: channel 0: is dead
debug2: channel 0: garbage collecting
debug1: channel 0: free: client-session, nchannels 1
debug3: channel 0: status: The following connections are open:
  #0 client-session (t4 r0 i3/0 o3/0 e[write]/0 fd -1/-1/8 sock -1 cc -1) 
debug3: send packet: type 1
debug1: fd 0 clearing O_NONBLOCK
debug3: fd 1 is not O_NONBLOCK
Transferred: sent 2204, received 1988 bytes, in 0.3 seconds
Bytes per second: sent 8019.7, received 7233.7
debug1: Exit status 1
fatal: Could not read from remote repository.
Syahrul
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 28, 2022

Hey @Juan Mendez 

Noted. Since this requires a complete verbose log to understand the issue, I have created a support ticket for you to continue the investigation further.

You can view your support ticket at the Support portal

Cheers,
Syahrul

juan.mendez-rey November 29, 2022

Thanks Syahrul,

Is that the correct link?

Syahrul
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 29, 2022

Hey @Juan Mendez 

My bad. I updated the link here. 

Cheers,
Syahrul

Like Juan Mendez likes this
0 votes
Syahrul
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 27, 2022

Hey @Juan Mendez 

G'day, and welcome to the community.

I believe your local ssh config maybe is not using the correct SSH key; hence your SSH connection is failing. Try using the following verbose commands instead:

GIT_TRACE_PACKET=1 GIT_TRACE=1 GIT_SSH_COMMAND="ssh -vvv" <git command>

Look for your SSH config and if it's using the correct SSH key to authenticate from the verbose log. For example:

14:28:37 debug1: Reading configuration data /etc/ssh/ssh_config
14:28:38 debug1: Next authentication method: publickey
14:28:38 debug1: Trying private key: /home/user/.ssh/id_rsa

Cheers,
Syahrul

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events