Saturday, August 13, 2016

Git Eclipse TFS 401 403 Unauthorized


Problem:
Eclipse Git plugin eGit used with TFS (Team Foundation Server) causes authentication error:
401 or 403 Unauthorized



Consequences:
Unable to validate SSL certificate.
Unknown certification authority.
SSL verification disabled.



Solution:
To make command line Git working:
Open: Edit Environment Variables For Your Account
Set user environment variable:
GIT_SSL_NO_VERIFY=true



To make eGit working, open Eclipse menu:
/ Window / Preferences / Team / Git / Configuration

Open tab User Settings:
Location: D:\.gitconfig
[http]
          sslVerify = true
[credential]
            helper = wincred

Open tab System Settings:
Location: C:\software\git\mingw64\etc\gitconfig
[credential]
            helper = manager



Details explained:
Due to issue jGit, eGit has to be configured as "sslVerify = true" to work properly. Otherwise causes "401 Unauthorized".
Command line Git needs "sslVerify = false", that is exactly oposite than eGit configuration. Fortunately, this directive can be overriden later by environment variable "GIT_SSL_NO_VERIFY=true".
Problem solved.