bash 无法连接到存储库:执行命令时出错:git.exe ls-remote -h https://github.com/szabbas/Sample-programs.git HEAD

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/35863528/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 22:12:51  来源:igfitidea点击:

Failed to connect to repository : Error performing command: git.exe ls-remote -h https://github.com/szabbas/Sample-programs.git HEAD

gitbashjenkins

提问by Syed

enter image description hereI am new to programming and trying to work with GIT repository and while configuring with the JENKINS is facing the error. I know it's a silly question but on a beginner point of view I am stuck and can't move forward. Please help me in resolving the error.

在此处输入图片说明我是编程新手并尝试使用 GIT 存储库,并且在使用 JENKINS 进行配置时遇到了错误。我知道这是一个愚蠢的问题,但从初学者的角度来看,我被卡住了,无法前进。请帮助我解决错误。

I have my code at the GIT repository and trying to build using jenkins. But it is giving the error as : Failed to connect to repository : Error performing command: git.exe ls-remote -h https://github.com/szabbas/Sample-programs.gitHEAD

我在 GIT 存储库中有我的代码并尝试使用 jenkins 进行构建。但它给出的错误是:无法连接到存储库:执行命令时出错:git.exe ls-remote -h https://github.com/szabbas/Sample-programs.gitHEAD

I have done to get the cloning through the GID bash and it is cloning with no issues with the URl. I am also attchingenter image description herethe image with the same.

我已经完成了通过 GID bash 进行克隆的工作,并且它的克隆与 URl 没有任何问题。我也附上在此处输入图片说明相同的图像。

回答by Moshisho

Got here much later because of the error mentioned in the question and for new comers, now you should verify your git path at:

由于问题中提到的错误和新来的人,很晚才到这里,现在您应该在以下位置验证您的 git 路径:

Jenkins > Manage Jenkins > Global Tool Configuration > Git

Jenkins > 管理 Jenkins > 全局工具配置 > Git

In my case it didn't have the path to git binary in the PATHenvironment variable, so I added: C:\Program Files\Git\binto it.

在我的情况下,它在PATH环境变量中没有 git binary 的路径,所以我添加了:C:\Program Files\Git\bin到它。

回答by Syed

I got the answer...just wanted to post here so that if some new programmer are there (like me) can look the basic things :-

我得到了答案......只是想在这里发帖,以便如果有一些新程序员(像我一样)可以看看基本的东西:-

While going in the project--> Configure--> set the path of the git correctly.

It should be till the bin and then append git.exe like *\bin\git.exe

它应该是直到 bin 然后附加 git.exe 像 *\bin\git.exe

回答by munna

In my case this issue happened because of there is no gitinstalled on my CentOS server.

就我而言,发生此问题是因为我的 CentOS 服务器上没有安装git

  1. sudo yum install git
  2. git --version
  1. 须藤 yum 安装 git
  2. git --version

After installing git i just make sure that my Global Tool Configuration default pointed to git Jenkins > Manage Jenkins > Global Tool Configuration > Git

安装 git 后,我​​只需确保我的全局工具配置默认指向 git Jenkins > 管理 Jenkins > 全局工具配置 > Git

  • Name : Default
  • Path to Git executable : git
  • 名称 : 默认
  • Git 可执行文件的路径:git

just posting this may help you in case of similar issue you had

如果您遇到类似问题,只需发布​​此内容可能会对您有所帮助