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

4 Answers 4


Specifically TCP 9418, no need for UDP.



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.

  • 3
    Thank you for the additional ports and justification for each. This is a more complete answer to the question. Commented Jan 30, 2017 at 14:48

Git uses port 9418. You can view connections using that port with

netstat -ntpl|grep -i 9418

Open 9418 and your traffic will pass through the firewall.

  • Got The term 'grep' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included I guess it is not linux
    – tribbloid
    Commented Jun 15, 2023 at 16:56
  • @tribbloid That's a PowerShell error.. The equivalent for grep there is Select-String.
    – cha0site
    Commented Jul 16, 2023 at 8:36

I've also found that the outbound SSH port 22 might need to be open as well as port 9418 for Git (both TCP). Depends on your setup though!

  • 2
    csf config for GIT TCP_IN = "9418" TCP_OUT = "9418,22" Commented Nov 20, 2013 at 9:07

You must log in to answer this question.

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