What firewall ports need to be open to allow access to external git repositories?

What firewall port(s) need to be open to allow access to external git repositories?


Specifically TCP 9418, no need for UDP.

Reference.


It depends on the repository.

The native git transport uses TCP port 9418. However, git can also run over ssh (often used for pushing), http, https, and less often others.

You can look at the repository URL to find out which port it uses. Notice that many public repositories have several alternate URLs; for instance, the kernel.org repositories have git://, http://, and https:// URLs.

The common URL schemes for git repositories are:

  • ssh:// - default port 22
  • git:// - default port 9418
  • http:// - default port 80
  • https:// - default port 443

If the URL does not have a scheme, it it using ssh with a slightly different syntax.

See the git fetch manpage for more details on the available URL schemes.