scm-manager / scm-ssh-plugin

SSH support for SCM-Manager
MIT License
0 stars 0 forks source link

Add support for scp-like syntax cloning #36

Open 40rn05lyv opened 2 years ago

40rn05lyv commented 2 years ago

Currently it's possible to clone only via standard syntax: git clone ssh://[user@]host.xz[:port]/path/to/repo Would be nice to support scp-like syntax [user@]host.xz:path/to/repo So, like in Github following should work: git clone git@localhost/repo where git username is used a placeholder.

https://stackoverflow.com/a/57520438/751200

pfeuffer commented 2 years ago

If I'm not mistaken, the URL is used to specify the port number. If you manage to run SCM-Manager with the default ssh port 22, you should be able to use the other syntax out of the box.

The other option is, to specify the port in you ssh config like this:

Host my-scm
    HostName my-scm-host
    Port 2222

With this, you can use

git clone user@my-scm:/repo/my/repository

Hope this helps.

40rn05lyv commented 2 years ago

@pfeuffer I tried to configure and run it with port 22, but it doesn't work

> git clone git@localhost:repo/scmadmin/repo3 repo32
Cloning into 'repo32'...
git@localhost: Permission denied (keyboard-interactive,publickey).
fatal: Could not read from remote repository.

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

With the same server git clone ssh://scmadmin@localhost:22/repo/scmadmin/repo3 repo31 works ok.

40rn05lyv commented 2 years ago

Actually. Yes, sorry, the scp syntax does work. The problem is that there's no such thing as "global Git user" so "git@localhost:path" doesn't work.

And I found that global Git user worked in the past (https://oss.aquenos.com/scm/scm-ssh-plugin/), and there was a configuration option to disable it ( com.aquenos.scm.ssh.auth.PublicKeyAuthenticator.disableGlobalGitUser).

pfeuffer commented 2 years ago

Ok, than I get it. I wasn't sure, whether the user git was crucial for you. This might be an improvement, but to be honest, I don't think that we will have the capacity for this in the near future.