0

At the place where I work we use git as our source control. The repository is set up privately. To connect to it I was provided only with a username and a password. SSH is used as a protocol. I was told that I can easily use SmartGit (paid GUI for git) to connect to the repo. I don't want to spend my money on this software and I want to work from the terminal. When I try to clone the repo (some parts censored),

git clone ssh://<username>@<server.com>/~<server_user>/repo/<project>

I don't even have a chance to enter my password, because I get an error:

Unable to negotiate with xxx.xxx.xxx.xxx port xxxx: no matching host key type found. Their offer: ssh-rsa,ssh-dss

The problem is that using the aforementioned GUI, I can easily choose Authentication Type and set it to Password and use it to clone the repo for the first time. I've tried to find the info on the internet, but only found guides on how to setup up keys on the server, which is not what I want.

I need to be able to connect to the git repo using ssh and login/password authentication without public/private keys.

bub1ick
  • 21
  • 6
  • If you have a username and a password, an http/https repository URL is expected instead of an ssh one. – ElpieKay Jul 04 '23 at 01:54
  • To use GIt-over-SSH first you have to solve SSH problems: https://stackoverflow.com/q/71731566/7976758 Found in https://stackoverflow.com/search?q=%5Bssh%5D+Unable+to+negotiate+no+matching+host+key+type+found.+Their+offer%3A+ssh-rsa%2Cssh-dss Check with `ssh @`. Then retry `git clone`. – phd Jul 04 '23 at 07:14
  • @phd, when I try `ssh @` I get `fatal: What do you think I am? A shell?`. Doing `git clone` afterwards results in the same error as before. – bub1ick Jul 04 '23 at 08:18
  • @ElpieKay, yes in general that is the case. However, in this particular instance the SSH protocol is used (I was provided with an `ssh://` type of link) and password authentication works with a third-party git GUI, so there must be a way to do that in terminal as well. – bub1ick Jul 04 '23 at 08:20
  • "*What do you think I am? A shell?*" is an answer from `git-shell` configured for the ``. `git clone` should work. If it doesn't I suspect `git-shell` or `git` at `` is improperly configured. – phd Jul 04 '23 at 08:39
  • @phd, that's the thing I don't quite understand. It works using third-party app for git, but not from terminal. I might be doing something wrong and that's what I want to figure out. By all means there shouldn't be any difference between GUI and CLI, but for some reason the latter doesn't work for me. – bub1ick Jul 04 '23 at 08:57
  • The only difference I can think of is `` — is it the same for CLI and GUI? – phd Jul 04 '23 at 10:49
  • @phd, Yes it is. Turns out SmartGit has its own ssh configured specifically for git. I've answered this question. Configuring right algorithms for the encryption solves the problem. The only question left is why I could connect to the server directly, but not through git. – bub1ick Jul 05 '23 at 07:53

1 Answers1

0

To fix this issue you need to specify these options in the [HOME_DIR]/.ssh/config file:

Host *
HostkeyAlgorithms +ssh-rsa
PubkeyAcceptedKeyTypes +ssh-rsa

After that is done, when connecting to git-shell it should prompt you with a password.

bub1ick
  • 21
  • 6