"Failed to connect to repository" Error while setting up Github Jenkins Plugin

You might need to set the path to your git executable in Manage Jenkins -> Configure System -> Git -> Git Installations -> Path to Git executable.

For example, I was getting the same error in Windows. I had installed git with chocolatey, and got the location via Powershell:

Get-Command git.exe | Select Definition

In Unix, you should be able to do:

which git

on Jenkins ver. 2.7.4, the setting property of (Path to Git executable) is now in Manage Jenkins -> Global Tool Configuration -> Git -> Git Installations -> Path to Git executable.