ssh git@sr.ht is asking password and denies me
Hey guys.
I'm trying to make the connection between my system and Sourcehut. I created my Ssh key and added pub key to the Sourcehut. Added the private key with the ssh-add ~/.ssh/id_ed25519
code after the "eval" thing.
Whenever I try ssh git@sr.ht
, it asks for password. I do not know what password it is and I'm entering my passphrase but it says permission denied.
On Github side, I managed everything without problem tho. Any hints?
EDIT: I removed Git and SSH keys completely. Reinstalled Git again. Followed the instructions step by step for the SSH keys and it worked this time. I have no idea what I did different this time but it works now after 3 hours of hell.. I suspect that I made a typo in config file in SSH directory. Thanks for comments guys! I love you all!
If this happens again,
ssh -vvv
does wonders to figure out where it is hanging or why it doesn't use a specific private key.One thing that has caused issues recently is a setting like this in my
.gitconfig
:It's a pretty common setting to use. I don't remember why it suddenly stopped working for me in January but I had to switch to doing this instead
Two additional thoughts, after doing a little research and re-reading your post:
According to this page, it looks like the git server for sourcehut is at
git.sr.ht
, notsr.ht
-- so make sure you're connecting to the right address.Secondly, in your original post you mention Github config. Sourcehut and Github are two totally different websites, and I'm not sure adding an ssh key to one will make it accessible by the other. Please confirm you're setting up the ssh key in the correct provider before connecting.
Hello!
I checked it as
git.sr.ht
as well and the result is same.I mentioned about Github just for the reference. I tried for the Github to see if I'm doing something wrong with generating SSH keys but it worked with Github. When I try to generate SSH key for Sourcehut, I'm having this problem. I seperated the keys by the way. I'm setting up the ssh key for the correct providers. They are not mixed in anyway. For test, I will remove all keys and make a new one for Sourcehut only to see how it goes.
OK, I understand. By the way, it's possible but not necessarily recommended to use the exact same key for both Github and Sourcehub. But if you generate a new key for each, probably add something to the filename to help you tell them apart.
So just so we're both on the same page, this is the new command you're trying?
$ ssh -i ~/.ssh/id_ed25519 git@git.sr.ht
Do you have a password set for your ssh-key? What output do you get from running ssh-add <path to key>?
If the dst-address is correct and the key is added, you ssh using -i <path to key> to specify key authentication. og that works you can vonsieer making an entry to .ssh/config
By default, you have to pass the identity file you're using to ssh using the -i flag. So, try this:
$ ssh -i ~/.ssh/id_ed25519 git@sr.ht
I think the ssh keyring is supposed to avoid having to use the -i flag every time, but I've never had success with it.
It should prompt for the passphrase before connecting. If you're being prompted for a password, it's trying publickey auth and skipped the identity file.
I tried your code but it still asked for a
git@sr.ht's password:
:(I do not understand what is the password here :/
I'm not sure either. The only other thing that comes to mind is that the public key needs to be added to the authorized_keys file on the host, if it's not there it will reject your identity file and fallback to publickey auth. As long as you properly added the public key (not private!) to sourcehut that shouldn't be an issue, but I've no idea otherwise why it would be rejecting your identity auth.
Do they support ed25519 keys? Does adding
-vv
show your key being rejected?Have you tried cloning a repository via SSH or are you specifically trying to do
ssh git@sr.ht
?I know GitHub shows a message when you do
ssh git@github.com
but as far as I can tell Sourcehut doesn't have this. I get the same password prompt when I try to dossh git@sr.ht
but I can clone repositories just fine.