# ERROR: Error fetching remote repo 'origin'

**URL:** <https://community.jenkins.io/t/error-error-fetching-remote-repo-origin/7304>\
**Category:** Using Jenkins\
**Tags:** question\
**Created:** [May 10, 2023, 9:41pm UTC](https://community.jenkins.io/t/error-error-fetching-remote-repo-origin/7304 "2023-05-10T21:41:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sima87000](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/sima87000/32/3832_2.png) [@sima87000](https://community.jenkins.io/u/sima87000)\
**Post date:** [May 10, 2023, 9:41pm UTC](https://community.jenkins.io/t/error-error-fetching-remote-repo-origin/7304/1 "2023-05-10T21:41:53Z")

</div>

Started by user [Sergio Iván Medel Ayala](http://localhost:8080/user/sima87000) Running as SYSTEM Building in workspace C:\Users\sergi.jenkins\workspace\Sample\_Java\_Program The recommended git tool is: NONE No credentials specified \> git.exe rev-parse --resolve-git-dir C:\Users\sergi.jenkins\workspace\Sample\_Java\_Program.git # timeout=10 Fetching changes from the remote Git repository \> git.exe config remote.origin.url [GitHub - sima87000/DemoJava](https://github.com/sima87000/DemoJava) # timeout=10 ERROR: Error fetching remote repo ‘origin’ hudson.plugins.git.GitException: Failed to fetch from [GitHub - sima87000/DemoJava](https://github.com/sima87000/DemoJava) at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:1003) at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1245) at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1309) at hudson.scm.SCM.checkout(SCM.java:540) at hudson.model.AbstractProject.checkout(AbstractProject.java:1240) at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:649) at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:85) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:521) at hudson.model.Run.execute(Run.java:1900) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:44) at hudson.model.ResourceController.execute(ResourceController.java:101) at hudson.model.Executor.run(Executor.java:442) Caused by: hudson.plugins.git.GitException: Command “git.exe config remote.origin.url [GitHub - sima87000/DemoJava](https://github.com/sima87000/DemoJava)” returned status code 128: stdout: stderr: fatal: not in a git directory at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2732) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2658) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2654) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1979) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1991) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.setRemoteUrl(CliGitAPIImpl.java:1599) at hudson.plugins.git.GitAPI.setRemoteUrl(GitAPI.java:161) at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:991) … 11 more ERROR: Error fetching remote repo ‘origin’ Finished: FAILURE

It was working before, don´t know why is not working now

---

<div class="post-metadata">

**Author:** ![halkeye](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/halkeye/32/8_2.png) [@halkeye](https://community.jenkins.io/u/halkeye)\
**Post date:** [May 10, 2023, 10:01pm UTC](https://community.jenkins.io/t/error-error-fetching-remote-repo-origin/7304/2 "2023-05-10T22:01:09Z")

</div>

Hi there,

Command line git included in recent container images includes a fix for a [security issue](https://security-tracker.debian.org/tracker/CVE-2022-24765). Command line git now refuses to perform operations in repositories when the directory is not owned by the current user.

[JENKINS-70540](https://issues.jenkins.io/browse/JENKINS-70540) includes a set of steps that show how to duplicate the issue. In that issue report, it is noted:

> Command line git has decided that it is dangerous to perform git operations in a directory owned by a different user. I may consider a way to better detect it and better alert the administrator that there is a problem, but ultimately it is a mistake to perform git operations in a directory owned by a different user without intentionally configuring the safe.directory to allow it.

The preferred alternative is to fix the permissions on the directories so that they are owned by the user that is calling command line git.

A description of command line git [CVE-2022-24765](https://nvd.nist.gov/vuln/detail/cve-2022-24765) is available in a [GitHub blog post](https://github.blog/2022-04-12-git-security-vulnerability-announced/#cve-2022-24765). The [Red Hat description](https://access.redhat.com/security/cve/cve-2022-24765) is also quite helpful, as is the [Debian description](https://security-tracker.debian.org/tracker/CVE-2022-24765).

---

<div class="post-metadata">

**Author:** ![tppalani](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/tppalani/32/6020_2.png) [@tppalani](https://community.jenkins.io/u/tppalani)\
**Post date:** [November 5, 2023, 3:20am UTC](https://community.jenkins.io/t/error-error-fetching-remote-repo-origin/7304/3 "2023-11-05T03:20:17Z")

</div>

Hi can you guide me how to fix this issue, I’m getting repo clone error

```auto
ERROR: Error fetching remote repo 'origin
pipeline.git" returned status code 128:
stdout: 
stderr: fatal: not in a git directory

```

---

<div class="post-metadata">

**Author:** ![MarkEWaite](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/markewaite/32/20_2.png) [@MarkEWaite](https://community.jenkins.io/u/MarkEWaite)\
**Post date:** [November 6, 2023, 4:25am UTC](https://community.jenkins.io/t/error-error-fetching-remote-repo-origin/7304/4 "2023-11-06T04:25:51Z")

</div>

See the [posted answer](https://community.jenkins.io/t/error-error-fetching-remote-repo-origin/7304/2) immediately before your question. Read the linked articles. Either fix the incorrect directory ownerships in your system or implement the workaround that disables the command line git check for directory ownership.
