Git clone, ssh: Could not resolve hostname
Now this was annoying. I tried a git clone ssh://user@my.host:/path/to/repository and it failed with
Initialized empty Git repository in /current/path/repository/.git/
ssh: Could not resolve hostname my.host:: Name or service not known
fatal: The remote end hung up unexpectedly
The solution was rather easy, see man 1 git-clone. A valid git clone command looks like this:
git clone ssh://username@host.xz/absolute/path/to/repo.git/
An alternative notation that allows for relative paths is
git clone username@host.xz:relative/path/to/repo.git/
The problem with the command I used initially was that I tried to use an scp-like syntax.
I am Nicolas Kuttler, a web developer, system administrator and IT consultant from France, currently living in Germany.





5 comments
Start a new thread