Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't access repositories with Git over SSH #1292

Closed
csu opened this issue May 25, 2015 · 11 comments
Closed

Can't access repositories with Git over SSH #1292

csu opened this issue May 25, 2015 · 11 comments

Comments

@csu
Copy link

csu commented May 25, 2015

I added an ssh key: 2015/05/25 02:31:23 [T] SSH key added: csu

I am using a non-standard port for ssh. When I try using ssh, I get:

csu:import (master)$ ssh -p nnnnn git@xyz
PTY allocation request failed on channel 0
Hi csu ! You've successfully authenticated, but Gogs does not provide shell access.
If this is unexpected, please log in with password and setup Gogs under another user.
Connection to xyz closed.

From the above output, it appears that the SSH connection over the port works and that authentication succeeded. However, this happens when I try using Git over SSH:

csu:import (master)$ setgip
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
@tboerger
Copy link
Contributor

tboerger commented Jun 1, 2015

You can't connect through SSH to the Gogs user.

@csu
Copy link
Author

csu commented Jun 1, 2015

Then how do you use Git over SSH?

On Mon, Jun 1, 2015 at 1:08 AM, Thomas Boerger notifications@github.com
wrote:

You can't connect through SSH to the Gogs user.

Reply to this email directly or view it on GitHub:
#1292 (comment)

@tboerger
Copy link
Contributor

tboerger commented Jun 1, 2015

Git over SSH is a total different thing. You just can't connect a normal SSH session.

@csu
Copy link
Author

csu commented Jun 1, 2015

That's not what the issue is about. The issue is saying that connection to normal SSH works, but when trying to use Git over SSH on the same port, it fails.

On Mon, Jun 1, 2015 at 1:11 AM, Thomas Boerger notifications@github.com
wrote:

Git over SSH is a total different thing. You just can't connect a normal SSH session.

Reply to this email directly or view it on GitHub:
#1292 (comment)

@csu csu changed the title Can't access repositories via SSH Can't access repositories with Git over SSH Jun 1, 2015
@lalomartins
Copy link

Seems to be the same problem as #1306 — in fact, your error message says already:

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

The tl;dr: you need to have your SSH key in your gogs account, not on the system's authorized_keys.

@csu
Copy link
Author

csu commented Jun 3, 2015

It's in both. It's added through the gogs account, which then appends it to the gogs user's authorized_keys automatically.

@lalomartins
Copy link

Then I can't help you, sorry 😦

Ah, in fact the message does say Permission denied (publickey). I missed that the first time.

This is probably obvious, so I hope you're not offended, but you're using the git url provided by the gogs UI, right?

And does that url provide your non-standard port? It could be that gogs only provides scp-style addresses, which don't allow a port. If that's the case, it's a bug. With a non-standard port, it should look like ssh://git@host.xz:xxxx/path/to/repo.git/. If this is the problem, you can work around it by of course tweaking the URL by hand, or by putting an alias in you ssh config.

http://stackoverflow.com/questions/1558719/using-a-remote-repository-with-non-standard-port

@csu
Copy link
Author

csu commented Jun 3, 2015

I'm using the one from Gogs. From what I recall, it did include the non-standard port in the url. Anyways, I've since given up on getting it to run on my own machine and have just installed it on a cloud VPS. Working perfectly on that :)

@unknwon
Copy link
Member

unknwon commented Aug 6, 2015

Looks this thread is finished?

Just a note before closing:

Permission denied (publickey).

This error shows that your request is denied by the SSH server, the Git request does not even get to Gogs. 😂

@unknwon unknwon closed this as completed Aug 6, 2015
@lalomartins
Copy link

FWIW

I'm using the one from Gogs. From what I recall, it did include the non-standard port in the url. Anyways, I've since given up on getting it to run on my own machine and have just installed it on a cloud VPS. Working perfectly on that :)

Sounds like it was something in your system (global) sshd config 😸

@trektrek
Copy link

here the same message, i solve changing the permission of ssh folder:
sudo chmod -R 600 .ssh
i hope this help somebody...

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants