#512  "Permission denied (publickey)" when pushing through SSH
Closed
Bart Riepe opened 2 years ago

As far as I can see I've done things correctly.

  1. Added SSH key to my profile
  2. Note down profile name user
  3. Add new origin to git: user@server:6611/group/repo
  4. Run git push

I've also tried substituting user with git since that's what Gitlab/Github seem to do, but no dice. I always get the Permission denied (publickey) error when I push.

Robin Shen commented 2 years ago

SSH clone url is different from GitHub/GitLab. Check the url here:

2022-01-01_23-08-44_2.png

Bart Riepe commented 2 years ago

Thank you for responding so quickly.

I think for me this was originally ssh://server:6611/group/repo, which seems in line with what is on code.onedev.io. Unfortunately, when I push using that my connection seems to hang forever.

bart in pop-os in evemarketeernew on  master via ?? took 1m5s 
❯ git push --verbose       
Pushing to ssh://onedev.jp.serial-experiments.com:6611/bart/evemarketeernew

i switched to something that removed the ssh:// protocol part, and that at least allowed me to connect, but started giving me the Permission denied (publickey) error.

❯ git push --verbose
Pushing to onedev.jp.serial-experiments.com:6611/bart/evemarketeernew
bart@onedev.jp.serial-experiments.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Bart Riepe commented 2 years ago

Also when manually specifying the onedev account name:

❯ git push --verbose
Pushing to onedev.jp.serial-experiments.com:6611/bart/evemarketeernew
Aeolun@onedev.jp.serial-experiments.com: Permission denied (publickey).
fatal: Could not read from remote repository.

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

Or cloning from the original URL (just to test), seems like it actually times out this time.

bart in pop-os in ~/Projects 
❯ git clone ssh://onedev.jp.serial-experiments.com:6611/bart/evemarketeernew test2
Cloning into 'test2'...
ssh: connect to host onedev.jp.serial-experiments.com port 6611: Connection timed out
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Robin Shen commented 2 years ago
For a test: please add your public key to your account at code.onedev.io, and then try to clone ssh://code.onedev.io:6611/onedev/server to see if it works. 
Bart Riepe commented 2 years ago

@robin I've fixed it by creating/restarting the docker instance on a different server (keeping the same data volume). I'm not quite sure why this fixed it where restarting the container didn't, it shouldn't theoretically be different, but I'll have to assume I messed up somewhere.

Thank you for your help, and for creating onedev 🙂

Robin Shen changed state to 'Closed' 2 years ago
Previous Value Current Value
Open
Closed
Robin Shen commented 2 years ago

Glad to see it is working now.

OneDev referenced from other issue 2 years ago
issue 1 of 1
Type
Question
Priority
Normal
Assignee
Issue Votes (0)
Watchers (3)
Reference
onedev/server#512
Please wait...
Page is in error, reload to recover