ERROR: Error cloning remote repo 'origin'
ERROR: Error cloning remote repo 'origin'
尝试使用配置选项,找不到工具
配置选项和 git 可执行部分。看起来是这么回事
仅在成功构建后发生。请帮忙。
这是我在控制台输出部分构建项目后收到的输出:
Building in workspace C:\Users\Anishas\.jenkins\workspace\Sample123
Cloning the remote Git repository
Cloning repository https://github.com/AnishaSalunkhe/HelloWorld.git
> C:\Users\Anishas\git init C:\Users\Anishas\.jenkins\workspace\Sample123 # timeout=10
ERROR: Error cloning remote repo 'origin'
hudson.plugins.git.GitException: Could not init C:\Users\Anishas\.jenkins\workspace\Sample123
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.execute(CliGitAPIImpl.java:656)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.execute(CliGitAPIImpl.java:463)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1057)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1097)
at hudson.scm.SCM.checkout(SCM.java:485)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1269)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:607)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
at hudson.model.Run.execute(Run.java:1738)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410)
Caused by: hudson.plugins.git.GitException: Error performing command: C:\Users\Anishas\git init C:\Users\Anishas\.jenkins\workspace\Sample123
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1726)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1695)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1691)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1321)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.execute(CliGitAPIImpl.java:654)
... 12 more
Caused by: java.io.IOException: Cannot run program "C:\Users\Anishas\git" (in directory "C:\Users\Anishas\.jenkins\workspace\Sample123"): CreateProcess error=5, Access is denied
at java.lang.ProcessBuilder.start(Unknown Source)
at hudson.Proc$LocalProc.<init>(Proc.java:240)
at hudson.Proc$LocalProc.<init>(Proc.java:212)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:815)
at hudson.Launcher$ProcStarter.start(Launcher.java:381)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1715)
... 16 more
Caused by: java.io.IOException: CreateProcess error=5, Access is denied
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(Unknown Source)
at java.lang.ProcessImpl.start(Unknown Source)
... 22 more
ERROR: null
Finished: FAILURE
将路径设置为 git.exe 而不仅仅是 git 文件在两个工具配置位置的目录。
这 在我的 Jenkins Windows slave 上浪费了很多时间。
我知道 git 在路径中,因为我在构建作业的批处理命令中执行了 "where git"。
where git
C:\Program Files (x86)\Git\cmd\git.exe
显然 Jenkins Git 插件 在 ** 环境被继承之前执行 **。
将您的从属路径设置为 Git(只管去做!!)
1) 转到您的 Windows 从属配置
管理 Jenkins > 管理节点
2) Select 你的从机配置
3) 在节点属性
下检查工具位置
4) 输入 git 可执行文件的完整路径,包括 git.exe
[x] Tool Locations
Name: (GIT) git
Home: C:\Program Files (x86)\Git\cmd\git.exe
见截图:
有时磁盘space较少时会出现此错误。所以请检查托管 jenkins 的机器的 space。 :)
转到 Manage Jenkins
/ Global Tool Configuration
并设置 Path to Git executable
:
如果有人使用新安装的 Jenkins Xcode,您需要使用 sudo xcodebuild -license
同意许可或通过 UI.
同意。
Windows:
1. 在 windows 机器上安装 git
2、git.exe路径为C:\ProgramFiles\Git\cmd\git.exe(默认情况下,除非你在安装时更改)
3.Now 需要在 Jenkins git 插件工具中显示 git.exe 的路径
a)管理 Jenkins>全局工具配置>Git
b) 添加 git : name: anything 和 Path:C:\Program Files\Git\cmd\git.exe
4. 然后为克隆构建。应该可以
Linux CentOS7:
我收到了同样的错误消息,在同一台机器上安装 git 之后安装了 Jenkins,它已解决。
百胜安装git
然后您需要按照以下步骤操作。希望这对您解决问题有用。
如果你的master是linux机器而slave是windows机器...
Pre-Requisites:
- 你的从机应该有相同的 java 版本(jdk 1.8)。
- Git 应该安装在您的从机上。
要遵循的步骤:
转到您的 Windows 从属配置 管理 Jenkins > 管理节点
Select你的slave配置
在节点属性
下检查工具位置
输入 git 可执行文件的完整路径,包括 git.exe
Tool Locations
Name: (GIT) git
Home: C:\Program Files (x86)\Git\cmd\git.exe
见截图:
不要忘记在 jenkins (http://yourjenkinsurl:8080/credentials/)
中添加您的部署密钥凭证(部署密钥附加到 github 项目)
1) 确保 git.exe 具有可执行权限。
2) 确保 git 被正确配置为引用全局工具配置以及 Jenkins 代理(windows 在你的情况下)你 运行 作业,[=12 的环境变量=] 可执行文件设置正确
- 在 linux 环境中的 Jenkins 服务器中检查以下命令:
`whereis git`
你会得到像/usr/bin/git
这样的路径
放在Manage jenkin>Global Tool Configuration>下git路径下提及/usr/bin/git
重新运行作业
我公司在 GitHub
迁移到 2FA(2 工厂认证)后出现此问题
在 Jenkins 中我获得了证书
修复它
- 我在 Github 中从 here
创建了一个个人访问令牌
2) 之后,当出现错误 ->Credential->add ->jenkins 时,我到达了 jenkins 中的同一个地方
然后如图所示得到
用户名=你想要的名字
密码 = 您获得的令牌
这可能有多种原因
- 检查文件夹或工作节点的权限,在我的例子中,第三个是问题,因为没有为用户和组提供权限。因此,您可能需要做
sudo chown -R user:group folderName
- 如果您使用来自 GitHub 的私有仓库,请检查您是否配置了 SSH 密钥。
- 路径必须在 Jenkins 默认全局配置中提供 Git
就我而言,
- 我已经在我的从属服务器上安装了 git。 Download-git
- 运行 cmd 命令
where git
并在 Jenkins 节点配置中使用如下所示的 exe 文件更新您的 git 路径。
C:\Program Files\Git\cmd\git.exe
转到您的 Windows 从属配置,管理 Jenkins > 管理节点 > Select 您的从属 > 配置
检查“节点属性”下的“工具位置”并提供从 'where git' 命令获得的完整路径并保存。
是的,我在 Linux ec2 实例上遇到了同样的问题,但我通过
修复了它
- 首先在你的服务器运行下面的命令,这个命令会return给你
$ git
此命令将 return 给你 git 的实际路径,你的 git 是这样安装的 /usr/bin/git 复制此路径。
- 打开你的 Jenkins > 去管理 Jenkins > 全局工具配置 > 将“Git 可执行文件的路径”粘贴到这个字段
我解决了将所有插件和 Jenkins 升级到 2.332.1 的问题
尝试使用配置选项,找不到工具 配置选项和 git 可执行部分。看起来是这么回事 仅在成功构建后发生。请帮忙。
这是我在控制台输出部分构建项目后收到的输出:
Building in workspace C:\Users\Anishas\.jenkins\workspace\Sample123
Cloning the remote Git repository
Cloning repository https://github.com/AnishaSalunkhe/HelloWorld.git
> C:\Users\Anishas\git init C:\Users\Anishas\.jenkins\workspace\Sample123 # timeout=10
ERROR: Error cloning remote repo 'origin'
hudson.plugins.git.GitException: Could not init C:\Users\Anishas\.jenkins\workspace\Sample123
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.execute(CliGitAPIImpl.java:656)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.execute(CliGitAPIImpl.java:463)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1057)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1097)
at hudson.scm.SCM.checkout(SCM.java:485)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1269)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:607)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
at hudson.model.Run.execute(Run.java:1738)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410)
Caused by: hudson.plugins.git.GitException: Error performing command: C:\Users\Anishas\git init C:\Users\Anishas\.jenkins\workspace\Sample123
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1726)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1695)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1691)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1321)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.execute(CliGitAPIImpl.java:654)
... 12 more
Caused by: java.io.IOException: Cannot run program "C:\Users\Anishas\git" (in directory "C:\Users\Anishas\.jenkins\workspace\Sample123"): CreateProcess error=5, Access is denied
at java.lang.ProcessBuilder.start(Unknown Source)
at hudson.Proc$LocalProc.<init>(Proc.java:240)
at hudson.Proc$LocalProc.<init>(Proc.java:212)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:815)
at hudson.Launcher$ProcStarter.start(Launcher.java:381)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1715)
... 16 more
Caused by: java.io.IOException: CreateProcess error=5, Access is denied
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(Unknown Source)
at java.lang.ProcessImpl.start(Unknown Source)
... 22 more
ERROR: null
Finished: FAILURE
将路径设置为 git.exe 而不仅仅是 git 文件在两个工具配置位置的目录。
这 在我的 Jenkins Windows slave 上浪费了很多时间。
我知道 git 在路径中,因为我在构建作业的批处理命令中执行了 "where git"。
where git
C:\Program Files (x86)\Git\cmd\git.exe
显然 Jenkins Git 插件 在 ** 环境被继承之前执行 **。
将您的从属路径设置为 Git(只管去做!!)
1) 转到您的 Windows 从属配置 管理 Jenkins > 管理节点
2) Select 你的从机配置
3) 在节点属性
下检查工具位置4) 输入 git 可执行文件的完整路径,包括 git.exe
[x] Tool Locations
Name: (GIT) git
Home: C:\Program Files (x86)\Git\cmd\git.exe
见截图:
有时磁盘space较少时会出现此错误。所以请检查托管 jenkins 的机器的 space。 :)
转到 Manage Jenkins
/ Global Tool Configuration
并设置 Path to Git executable
:
如果有人使用新安装的 Jenkins Xcode,您需要使用 sudo xcodebuild -license
同意许可或通过 UI.
Windows: 1. 在 windows 机器上安装 git 2、git.exe路径为C:\ProgramFiles\Git\cmd\git.exe(默认情况下,除非你在安装时更改) 3.Now 需要在 Jenkins git 插件工具中显示 git.exe 的路径
a)管理 Jenkins>全局工具配置>Git
b) 添加 git : name: anything 和 Path:C:\Program Files\Git\cmd\git.exe 4. 然后为克隆构建。应该可以
Linux CentOS7: 我收到了同样的错误消息,在同一台机器上安装 git 之后安装了 Jenkins,它已解决。
百胜安装git
然后您需要按照以下步骤操作。希望这对您解决问题有用。
如果你的master是linux机器而slave是windows机器...
Pre-Requisites:
- 你的从机应该有相同的 java 版本(jdk 1.8)。
- Git 应该安装在您的从机上。
要遵循的步骤:
转到您的 Windows 从属配置 管理 Jenkins > 管理节点
Select你的slave配置
在节点属性
下检查工具位置
输入 git 可执行文件的完整路径,包括
git.exe
Tool Locations
Name: (GIT) git
Home: C:\Program Files (x86)\Git\cmd\git.exe
见截图:
不要忘记在 jenkins (http://yourjenkinsurl:8080/credentials/)
中添加您的部署密钥凭证(部署密钥附加到 github 项目)1) 确保 git.exe 具有可执行权限。 2) 确保 git 被正确配置为引用全局工具配置以及 Jenkins 代理(windows 在你的情况下)你 运行 作业,[=12 的环境变量=] 可执行文件设置正确
- 在 linux 环境中的 Jenkins 服务器中检查以下命令:
`whereis git`
你会得到像/usr/bin/git
放在Manage jenkin>Global Tool Configuration>下git路径下提及/usr/bin/git
重新运行作业
我公司在 GitHub
迁移到 2FA(2 工厂认证)后出现此问题在 Jenkins 中我获得了证书
修复它
- 我在 Github 中从 here 创建了一个个人访问令牌
2) 之后,当出现错误 ->Credential->add ->jenkins 时,我到达了 jenkins 中的同一个地方
然后如图所示得到 用户名=你想要的名字 密码 = 您获得的令牌
这可能有多种原因
- 检查文件夹或工作节点的权限,在我的例子中,第三个是问题,因为没有为用户和组提供权限。因此,您可能需要做
sudo chown -R user:group folderName
- 如果您使用来自 GitHub 的私有仓库,请检查您是否配置了 SSH 密钥。
- 路径必须在 Jenkins 默认全局配置中提供 Git
就我而言,
- 我已经在我的从属服务器上安装了 git。 Download-git
- 运行 cmd 命令
where git
并在 Jenkins 节点配置中使用如下所示的 exe 文件更新您的 git 路径。
C:\Program Files\Git\cmd\git.exe
转到您的 Windows 从属配置,管理 Jenkins > 管理节点 > Select 您的从属 > 配置
检查“节点属性”下的“工具位置”并提供从 'where git' 命令获得的完整路径并保存。
是的,我在 Linux ec2 实例上遇到了同样的问题,但我通过
修复了它- 首先在你的服务器运行下面的命令,这个命令会return给你 $ git 此命令将 return 给你 git 的实际路径,你的 git 是这样安装的 /usr/bin/git 复制此路径。
- 打开你的 Jenkins > 去管理 Jenkins > 全局工具配置 > 将“Git 可执行文件的路径”粘贴到这个字段
我解决了将所有插件和 Jenkins 升级到 2.332.1 的问题