Issue
When performing a checkout in a build the following error is thrown:
stderr: remote: Repository not found. fatal: repository '<REPO_URL>' not found at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2671) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2096) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$500(CliGitAPIImpl.java:84) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:618) at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:999)
Resolution
There are a few areas to check for the cause of this issue:
-
Confirm that the
Repository URL
in your jobs configuration is actually correct. -
Verify that the credentials being used to perform the checkout are also correct and working. This should first be verified outside of the controller by performing a CLI checkout with the same credentials. Then verify on the controller by selecting the credentials from the dropdown list in the jobs configuration.
-
Check for a credential helper on both the controller and the agent. The credential helpers store credentials on the OS and can be automatically used by git instead of the credentials that the controller is providing. See Git - gitcredentials Documentation
-
Run the following commands on the controller and agent to find any set credential helpers. If one is found, it will return an non-empty output:
git config --local credential.helper (should be run in the directory of the local git repository) git config --global credential.helper git config --system credential.helper
-
If a credential helper is found, it can be unset with the following command (use the same scope where the credential helper was found):
git config [--local | --global | --system] --unset credential.helper
-