Jenkins cannot find GH repository

We have 2 Jenkins servers with the same configuration, plugins, and GH PAT credentials, and they are executing different jobs from a long time ago.
We plan to use both of them to balance the workload of new jobs, as we must connect to two different GH repositories in the same GH Enterprise org.
We also have the same two new jobs, one per repository, in both servers, and they are working fine in one of the servers, but the other is returning the following for both jobs:

Caused by: hudson.plugins.git.GitException: Command “git.exe fetch --tags --force --progress – XXXXXXX · GitHub +refs/heads/:refs/remotes/origin/” returned status code 128:
stdout:
stderr: remote: Repository not found.
fatal: repository ‘XXXXXXX · GitHub’ not found
ERROR: Error fetching remote repo ‘origin’
ERROR: Maximum checkout retry attempts reached, aborting

We can reach the repository from that server through the browser, so it is reachable and there is no connectivity issue.
So it seems some Jenkins issue, but we reviewed everything several times and looks fine.
The only differences we can see between both servers are:

  1. We can find in the logs that the server that is working fine is cloning the repository right after the line that is showing the credentials in use, but the server that is not working is fetching changes and upstream changes instead, even when both jobs have exactly the same code.
  2. The Jenkins server that is working fine has the local repository created, as we started to develop jobs and test everything there long time ago, but the new server which is having issues never doesn´t have it. I believe it shouldn´t be an issue, as it should be created when the job is executed.

Any idea about what could be the cause of not reaching the repository?

Thanks in advance.

As you’re on windows do you run Jenkins as a service? If yes under which account are they running? When you checked connectivity did you use the same user that is used for running Jenkins?
Do you connect via ssh or via https to github?

On a side node when you have identical jobs that both work with the same repository on both Jenkins instances how do you avoid that the jobs start on both?

Yes, we are on Windows and the service is run as Local System in both servers.
When I checked connectivity on browser I open the browser with my user session.
We are using https, with the same PAT in both servers.
Currently, both jobs cannot start at the same time as we are testing and manually firing them. Once they are working fine in both, we´ll run each repository job in a different server, so they will not be executed at the same time.

Regards,
Javier

It is not recommended running Jenkins as the local system account. See Windows

2 Likes

@mawinter69 It was indeed the root cause of this issue.
When I changed to my user, it worked as expected, so it seems to have a lack of permissions for that server´s LocalSystem account.

Thanks for your help.

Regards,
Javier

2 Likes

It is quite strange, but after several hours of working as expected with my user as the Jenkins service running user and with no other changes to the Jenkins server, it started to fail again with the same error message: “Repository not found”.
We raised a Hornbill ticket to our Security Team, and they confirmed everything is configured the same for both Jenkins servers.
After investigating for several days, I cannot find any reason why it worked and stopped.
Any idea of what could be the reason for this issue?

Regards,
Javier