Cloning over ssh woes

I am new to gitea so this is likely a newbie question, but I have looked on this forum and the internet for a solution to get ssh cloning to work. However I miss some basic understanding in order to do so…

My setup:

  • server with Ubuntu 22.04
  • I connect to this server over ssh for years
  • the sshd config has PAM enabled
  • I created a user that runs gitea, following the official install instructions, without password but with a homefolder:
adduser --system --shell /bin/bash --gecos 'Git Version Control' --group --disabled-password --home /home/gitea gitea
  • I installed gitea from the binary and can access it succesfully through a reverse proxy
  • I created a user ‘roel’ and in the preferences for that user added a (public) ssh key
  • When I log in to the server and look in the .ssh/authorizedkeys file that key is there (so the gitea user is able to manage the keys)
  • I added a new repo for that user (‘beervault’, something to manage my aged beer collection :wink: )
    I can check out that repo over https but not over ssh: it keeps asking for a password for the gitea user:
git clone -v ssh://gitea@<git.mydomain.be>:4222/roel/beervault.git
Cloning into 'beervault'...
gitea@git.1236.be's password:

I am clearly doing something wrong but can’t find a handle about what is going on and how to debug it. Any ideas how to start troubleshooting ?

(facepalm) solved it, replying for posteriority: I was cloning with the wrong (default) ssh key, not the new key that I made for the user and added for that user in the GUI, hence the failures.

GIT_SSH_COMMAND="ssh -i ~/.ssh/id-rightid" git clone -v ssh://gitea@<git.mydomain.be>:4222/roel/beervault.git

works as expected and can now be cleaned up.

1 Like