Am I integrating GitHub with Jenkins wrong?

I ma trying to integrate Github with Jenkins. I ran into a problem where it can’t reach the repo using git. Am I doing this right? Why isn’t it working?

git ls-remote -h
a8834f1b27131abe980f08c6743c0f1c35792267        refs/heads/feature/method-handles
b9916a6a3a66a398e95b4a35525cc316c9c84ae8        refs/heads/illegal-packets
4015f55f2cd2b80252d41af1544e6fa3f7db4a29        refs/heads/master
23c2f01936746a3f04b85e221127ba38456cfb70        refs/heads/plugin-messages

Seems to run fine for me. I’d start by running that command as the jenkins service user and see what it says, maybe git isn’t in path for that user?

Also highly recommend you use github integration not git, you’ll get better performance as it uses apis instead of raw git commands, and can update commit status and all the other fancy github features.

It could be anything - for example Jenkins unable to find “git.exe” (not reachable via its $PATH). Maybe Jenkins server log has more information.

How would I do GitHub integration correctly then? I thought that’s how you do it by using the http.

There is the GitHub plugin: that uses GitHub APIs under the hood. Mind you this has a dependency on Git itself, so if you aren’t able to clone your repo using git alone, I’m going to venture a guess and say GitHub integration at this stage won’t help you.

That clone dialog box just shows you the different methods one is able to clone the repository using such as HTTPS, SSH, and GitHub CLI. You still need the tools to do such.

Is there potentially a firewall or proxy setup that isn’t allowing you to access

Also does the repository have anonymous read setup and is public? I don’t see you using any credentials to perform connection.

I think it is worthwhile to check how your “git client” plugin is configured and which Git implementation is going to be used:

I don’t know how I didn’t see this, but the problem was it couldn’t find git.exe because git wasn’t installed. Everything works fine now. Thanks for everyone who tried to help.

1 Like