Can't get Jenkins to recognise a git repo

时间:2016-08-31 18:08:05

标签: windows git jenkins gradle

Trying to get Jenkins to run with Gradle etc. Please note that this is a Windows 10 OS. Not Linux.

I want to use a git repo on my local machine, under D:\temp\.git\. There is a file HEAD there.

On the "Source Code Management" page I enter the following in Repository URL:

file:///D:/temp/.git/

(NB I have played around a lot with the number (and type) of slashes here... nothing works)

The response comes:

Failed to connect to repository : Command "git.exe -c core.askpass=true ls-remote -h file:///D:/temp/.git/ HEAD" returned status code 128:
stdout:
stderr: fatal: '/D:/temp/.git/' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.

I note that it says "from remote repository". Just wondering if it might be a question of tweaking something somewhere to specify a local repository... ?

Plus I also then tried running this same command at a DOS prompt without and then with Administrator rights:

D:\temp>git.exe -c core.askpass=true ls-remote -h file:///D:/temp/.git/HEAD
fatal: Invalid gitfile format: D:/temp/.git/HEAD
fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.

... which is puzzling. "invalid gitfile format" - what's that about? Plus the "access rights" thing: could it be that this is happening due to some nonsense to do with Windows UAC? But even with Admin rights I get the same message.

A bit later:
This command works at the command prompt, including as a non-administrator, if you omit the word "HEAD":

D:>git.exe -c core.askpass=true ls-remote -h file:///D:/temp a4ca18f7b218ef57b07f8dceef89ab6bdb5839a6 refs/heads/master

D:>git.exe -c core.askpass=true ls-remote -h file:///D:/temp/.git a4ca18f7b218ef57b07f8dceef89ab6bdb5839a6 refs/heads/master

1 个答案:

答案 0 :(得分:0)

在您的情况下,您不希望将Git存储库配置为跟踪。由于您在本地(仅限)工作,因此将自定义工作区配置为指向您的存储库(常规 - >高级)就足够了。

这将是D:\temp D:\temp\.git,因为.git目录,其中Git会保留有关您的信息库中。