I am trying to access a git respository at a IPv6 address that has a SSH server listening on port 1111(for example).

Access is controlled by SSH key and I can open a SSH session on the gitserver using

ssh git@<IPv6-address> -p 1111

(Yes, I understand that git should not get a shell, but please disregard that)

I can access the repository using IPv4 like this :

git clone git@<IPv4-address>:1111/git/tarn.git 

But the IPv6 version does not work.

git clone git@<IPv6-address>:1111/git/tarn.git
 Cloning into 'tarn'...
ssh: connect to host <IPv6 address> port 22: No route to host
fatal: Could not read from remote repository.

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

What do I need here?

  • 3
    IPv6 address literals usually go in square brackets to distinguish their colon from the IP-vs-port colon: git clone 'foo@[::1]:4711/this/that.git', but I don't have a setup here to verify. Remember the shell may have ideas about what [] means if you don't quote it. Jun 28, 2019 at 5:03
  • Is the IPv6 address a link-local address (beginning with FE80) or a globally routable address (beginning with 2)? Can you ping the address? Jun 28, 2019 at 5:32
  • @JohanMyréen This is not a fe80 addresss. scope global dynamic noprefixroute Jun 28, 2019 at 11:46
  • @UlrichSchwarz Ah! That's the answer. Jun 28, 2019 at 11:53
  • OpenSSH rejected the brackets feature request for ssh (even though scp supports it) bugzilla.mindrot.org/show_bug.cgi?id=1602
    – MarcH
    May 15, 2020 at 23:11

1 Answer 1


You can put the SSH port in you local SSH client configuration file, then you won't have to specify it with a connection attempt (either with ssh directly or through git).

Just create a file ~/.ssh/config and add:

Host <IPv6-address>
    Port 1111

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .