开发者

Git ssh connection refused with the following format

开发者 https://www.devze.com 2023-04-05 12:29 出处:网络
Whenever I use the following url = ssh://user@dev.example.com:imageInfo.git in .git/config for a remote repo I get the following error

Whenever I use the following

url = ssh://user@dev.example.com:imageInfo.git

in .git/config for a remote repo I get the following error

 ssh: connect to host  port 22: Connection refused
 fatal: The remote end hung up unexpectedly

but if use the following

ssh user@dev.example.com

outside of git I connect without a problem. Git also connects to same server with a gitosis user using

 url = gitosis@dev.example.com:imageInfo.git 

in .git/config and it has not problems.

so to sum things up in short my .git/config file looks like this

 [remote "production"]
        url = ssh://user@dev.exam开发者_运维技巧ple.com:imageInfo.git
        url = gitosis@dev.example.com:imageInfo.git

any ideas?


You have the format of the SSH URL wrong - you can either use the scp-style syntax, like:

user@dev.example.com:imageInfo.git

... or the true URL form, where you need a / after the host rather than a :, and an absolute path, which I can only guess at, e.g.:

ssh://user@dev.example.com/srv/git/imageInfo.git

The documentation for git's URLs is here, but kernel.org is down at the moment, so you may want to look at the cached version here.


I got this message due to not having sshd daemon installed and running. So I did 'sudo apt-get install ssh' and the issue was solved.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号