Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git ssh connection refused with the following format

Tags:

git

macos

ssh

Whenever I use the following

url = ssh://[email protected]: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 [email protected]

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

 url = [email protected]: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://[email protected]:imageInfo.git
        url = [email protected]:imageInfo.git

any ideas?

like image 641
mike Avatar asked Mar 22 '26 20:03

mike


1 Answers

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

[email protected]: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://[email protected]/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.

like image 57
Mark Longair Avatar answered Mar 25 '26 09:03

Mark Longair



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!