Jenkins configuration of git plugin

后端 未结 1 2224
渐次进展
渐次进展 2021-02-19 17:32

I get this error when configuring git repo in a new jenkins project:

Failed to connect to repository : Error performing command:  ls-remote -h file:///c:\\Dev\\g         


        
1条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-19 18:03

    Windows installs Jenkins as a service. But it runs the Jenkins service under different user permissions that don't have access to GIT. You can follow this link to find the user that Jenkins runs under. http://antagonisticpleiotropy.blogspot.com/2012/08/running-jenkins-in-windows-with-regular.html

    For example. My local user name on my windows is "nathandrewsire", exclude the quotes. Open windows services manager (either cmd and c:\services.msc, OR use windows key + R). Enable Log On > This account:. Then type in .\username (e.g. .\nathandrewsire). Then restart the service and you will have access to GIT from Jenkins builds.

    I also found a snippet for windows shell command that will output the user to verify it. echo %PATH% echo %USERDOMAIN%\%USERNAME%

    http://antagonisticpleiotropy.blogspot.com/2012/08/running-jenkins-in-windows-with-regular.html

    Linux

    If you're using Linux, this error can also be caused from not enabling share on your Git repo. Linux jenkins user won't be able to access Git report under another user unless.... git --bare init --shared=group Also, your jenkins user and Git repo user must belong to the same group for file permission access. There's other alternatives to that like messing with umasks and ACL's but setting up a linux group for your two users is the easiest way.

    Make sure NOT TO OVERWRITE your Git repo with the bare init command. If you already have a Git repo, you'll need to setup/move to a new one with the shared option. I didn't see a way to convert existing repos to shared because I am guessing the files would all need to be updated?

    NOTE*** I used VMWare Workstation shared folders to build on a windows guest. Jenkins needs the following format when entering the Git repo.

    //vmware-host/Shared Folders/vm-share/ridcyDevelopment.git/

    Unable to get Jenkins and Git to play nice

    0 讨论(0)
提交回复
热议问题