# Jenkins to use git locally

**URL:** <https://community.jenkins.io/t/jenkins-to-use-git-locally/19299>\
**Category:** Using Jenkins\
**Created:** [September 9, 2024, 4:41pm UTC](https://community.jenkins.io/t/jenkins-to-use-git-locally/19299 "2024-09-09T16:41:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jacck](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/jacck/32/10052_2.png) [@Jacck](https://community.jenkins.io/u/Jacck)\
**Post date:** [September 9, 2024, 4:41pm UTC](https://community.jenkins.io/t/jenkins-to-use-git-locally/19299/1 "2024-09-09T16:41:03Z")

</div>

I try to set up the system property ‘hudson.plugins.git.GitSCM.ALLOW\_LOCAL\_CHECKOUT’ to true. I am doing it in Script Console, and getting response True. But still can not work with my local git. How to make it really working?

---

<div class="post-metadata">

**Author:** ![poddingue](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/poddingue/32/985_2.png) [@poddingue](https://community.jenkins.io/u/poddingue)\
**Post date:** [September 10, 2024, 8:25am UTC](https://community.jenkins.io/t/jenkins-to-use-git-locally/19299/2 "2024-09-10T08:25:41Z")

</div>

Hello @Jacck and welcome to this community. 👋

As far as I know, to enable Jenkins to use a local Git repository, you need to set (as you did) the system property `hudson.plugins.git.GitSCM.ALLOW_LOCAL_CHECKOUT` to `true` and make sure that Jenkins has the necessary permissions to access the local repository. 🔎

Here are some steps that might help you to achieve this:

1. You can set the system property in the Jenkins Script Console as you did: `System.setProperty('hudson.plugins.git.GitSCM.ALLOW_LOCAL_CHECKOUT', 'true')`
2. In your Jenkins job configuration, set the repository URL to the local path of your Git repository. For example, if your repository is located at `/path/to/your/repo`, set the repository URL to `file:///path/to/your/repo`.
3. Make sure that the Jenkins user has read and write permissions to the local Git repository directory.
4. Sometimes, changes to system properties require a Jenkins restart to take effect. 🤷  
Restart Jenkins to ensure the property is applied.

Here is an untested example of how to configure the repository URL in a Jenkins pipeline:

```auto
pipeline {
    agent any
    stages {
        stage('Checkout') {
            steps {
                git url: 'file:///path/to/your/repo', branch: 'main'
            }
        }
        stage('Build') {
            steps {
                // Your build steps here
            }
        }
    }
}

```

---

<div class="post-metadata">

**Author:** ![mawinter69](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/mawinter69/32/1625_2.png) [@mawinter69](https://community.jenkins.io/u/mawinter69)\
**Post date:** [September 11, 2024, 10:49pm UTC](https://community.jenkins.io/t/jenkins-to-use-git-locally/19299/3 "2024-09-11T22:49:58Z")

</div>

Setting a system property via script console will not change the value. The reason is that the system property is evaluated once at Jenkins startup. You can set the property as a command line parameter to the JVM of Jenkins (`java -Dhudson.plugins.git.GitSCM.ALLOW_LOCAL_CHECKOUT=true -jar jenkins.war ...`)  
But you can still modify the behaviour of the git plugin by running  
`hudson.plugins.git.GitSCM.ALLOW_LOCAL_CHECKOUT=true` in the script console.

---

<div class="post-metadata">

**Author:** ![ambraspace](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/ambraspace/32/14437_2.png) [@ambraspace](https://community.jenkins.io/u/ambraspace)\
**Post date:** [April 22, 2025, 9:46pm UTC](https://community.jenkins.io/t/jenkins-to-use-git-locally/19299/4 "2025-04-22T21:46:53Z")

</div>

Hi, everyone!  
I was looking for a solution for how to use Jenkins locally (without pushing to remote repository and checking out of it) and one way to do it is to use a git daemon to make local git server, like this:  
`$ git daemon --verbose --export-all --base-path=<development-dir> <development-dir>`  
After that you can use URL git://localhost/my-app as Git project repository.
