git clone ssh ask for password
-
wrote on Feb 14, 2024, 12:45 PM last edited by hosni6 Feb 14, 2024, 1:29 PM
-
From the error it appears that the key is not accepted. I just tried to reproduce this, but it works at least on a fresh installation. Can you maybe try to generate a fresh key maybe with the default keygen configs, maybe that specific key is not supported?
-
-
wrote on Mar 25, 2024, 3:47 PM last edited by bwag Mar 25, 2024, 3:52 PM
I am getting this error on a fresh install as well, call it gitea.example.com:
$ git clone ssh://git@gitea.example.com:29418/user/test-repo.git Cloning into 'test-repo'... git@gitea.example.com's password:
I wondered if it's possible the port is wrong, and the command is trying to ssh into the machine as user git, instead of trying to log in. I did try from two different machines with their own ssh keys. I also tried with a verified public key:
$ git clone ssh://git@gitea.example.com:/user/test-repo.git Cloning into 'test-repo'... git@gitea.example.com: Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
-
You probably miss the
Host
section for your gitea origin in~/.ssh/config
To let git know which ssh key to use.
This should look something like this:Host git.domain.com IdentityFile ~/.ssh/id_rsa IdentitiesOnly yes
wrote on Mar 25, 2024, 3:57 PM last edited byHmm, I still get the same behavior after adding that .ssh/config. (Both machines I'm testing from only have one ssh key, if it matters.)
-
wrote on Mar 25, 2024, 4:02 PM last edited by
I am looking at issues like this (maybe on the wrong track). https://github.com/go-gitea/gitea/issues/11050
Thank you for any help. Will report back if I find anything. -
Are you behind Cloudflare maybe? Or some other firewall in the front?
Usually, the way to debug git ssh issues is like this:
GIT_SSH_COMMAND="ssh -vvv" git clone ssh://git@gitea.example.com:29418/user/test-repo.git
This will show you what ssh keys of yours it is trying to use.
-
wrote on Mar 26, 2024, 5:13 AM last edited by bwag Mar 26, 2024, 5:32 AM
Thank you, I have been using that command to debug though without success so far. I am not behind Cloudflare or any firewall.
I only have one ssh key on the machines I am using to test. I verified it in the Gitea interface, but it is rejected:
$ GIT_SSH_COMMAND="ssh -vvv" git clone ssh://git@gitea.example.com:29418/user/test-repo.git # ... debug1: Next authentication method: publickey debug1: Offering public key: /home/linuxuser/.ssh/id_rsa RSA SHA256:XXXXX explicit agent debug3: send packet: type 50 debug2: we sent a publickey packet, wait for reply debug3: receive packet: type 51 debug1: Authentications that can continue: publickey,password debug2: we did not send a packet, disable method debug3: authmethod_lookup password # ...
I am curious about the difference between these command formats for cloning a repo:
git clone ssh://git@gitea.example.com:29418/user/test-repo.git # Cloudron Gitea git clone git@gitea.example2.com:user/test-repo.git # non-Cloudron Gitea
I also get this difference: with Cloudron,
$ ssh -p 29418 git@gitea.example.com git@gitea.cutheory.dev's password:
but with non-Cloudron,
$ ssh git@gitea.example2.com Hi there, user! You've successfully authenticated with the key named <keyname>, but Gitea does not provide shell access.
-
wrote on Mar 26, 2024, 6:02 AM last edited by
Well, I uninstalled and reinstalled the gitea app and I don't reproduce the issue -- cloning now works. Sorry if I've wasted anyone's time. If it happens again, I'll try to diagnose why and report back.
-