Jenkins --- git can't clone:Permission denied (publickey).

最近在学习搭建Jenkins,配置好环境后,构建的时候,老提示错误如下:


Cloning the remote Git repository
Cloning repository origin
ERROR: Error cloning remote repo 'origin' : Could not clone git@github.com:cherry-zhang/game-of-life.git
hudson.plugins.git.GitException: Could not clone git@github.com:cherry-zhang/game-of-life.git
	at hudson.plugins.git.GitAPI.clone(GitAPI.java:251)
	at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1122)
	at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1064)
	at hudson.FilePath.act(FilePath.java:842)
	at hudson.FilePath.act(FilePath.java:824)
	at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1064)
	at hudson.model.AbstractProject.checkout(AbstractProject.java:1248)
	at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:589)
	at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)
	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:494)
	at hudson.model.Run.execute(Run.java:1488)
	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
	at hudson.model.ResourceController.execute(ResourceController.java:88)
	at hudson.model.Executor.run(Executor.java:236)
Caused by: hudson.plugins.git.GitException: Command "D:\install\Git\bin\git.exe clone --progress -o origin git@github.com:cherry-zhang/game-of-life.git E:\Learnings\Jenkins\workspace\gamelife-default" returned status code 128:
stdout: Cloning into E:\Learnings\Jenkins\workspace\gamelife-default...
 
stderr: Permission denied (publickey).
fatal: The remote end hung up unexpectedly

	at hudson.plugins.git.GitAPI.launchCommandIn(GitAPI.java:818)




但是直接用git命令行,完全是ok的。

搜索尝试了所有答案后,问题解决如下:

在jenkins中,把git的设置由git.exe改成git.cmd即可。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值