Windows Firewall, Tinywall and GIT
Asked Answered
E

3

6

Just finally updated to Win7 from XP.
I am using Windows Firewall with added Tinywall (gives more control)

But when I use Git Bash, the firewall blocks all commands. If I disable the firewall then everything works OK

I cannot figure the proper exceptions to add to TinyWall whitelist.

I added the shell window as well as the git.exe for application exceptions but still no go. These exceptions program paths I added:

C:\Program Files (x86)\Git\git-cheetah\..\bin\sh.exe
C:\Program Files (x86)\Git\bin\git.exe

Example of error:

$ git pull
ssh: connect to host xxx.xxx.xxx port 22: Bad file number
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Ebba answered 31/5, 2014 at 0:48 Comment(0)
E
13

To get TinyWall to work with git over SSH, you must white-list:

sh.exe
git.exe
ssh.exe

To work with git over HTTPS, you need only whitelist:

C:\Program Files (x86)\Git\libexec\git-core\git-remote-https.exe

or

C:\Program Files\Git\mingw64\libexec\git-core\git-remote-https.exe
Ebba answered 3/6, 2014 at 16:4 Comment(2)
If you see the error described in the OP using Atlassian's SourceTree, whitelist C:\Program Files (x86)\Atlassian\SourceTree\tools\putty\plink.exe as well, that solved my issue.Piano
To make git work with ssh I had to add the ssh.exe found in Git\usr\bin\ssh.exe. To my firewall exit rules. I've also put ssh-agent.exe but not sure if it was needed.Trigonous
N
1

On Windows 10 with TinyWall i had to add exception for:

C:\Program Files\Git\mingw64\libexec\git-core\git-credential-manager.exe

in addition to:

C:\Program Files\Git\bin\git.exe

C:\Program Files\Git\bin\sh.exe

C:\Program Files\Git\mingw64\libexec\git-core\git-remote-https.exe

Nellnella answered 13/4, 2019 at 12:57 Comment(1)
This is basically the same as this answer. Please don't repost answers.Ambroid
L
0

If restarting your shell on Widows (after setting the whitelist) doesn't work, a workaround would be to use the port 443 for your ssh git session.
See this answer, also detailed in GitHub "using ssh over the https port".

Or you can try and switch to an https url, if your server supports it.

Louls answered 31/5, 2014 at 5:1 Comment(3)
no idea if the server supports https url (still not very familiar with git). I was hoping to be able to unblock those ports somehow instead of a work around.Ebba
@Ebba is that server a known git hosting repo service? (like GitHub or BitBucket). Or is it a private server?Louls
VonC - private hostingEbba

© 2022 - 2024 — McMap. All rights reserved.