无法克隆存储库 [英] Could not clone repository

查看:314
本文介绍了无法克隆存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我真的很坚持这一点。我在哈德森创造了一份工作,并以与其他工作相同的方式进行了配置。我的项目和构建交付物存在于Git中。
但每次我尝试构建它时,我都会收到以下错误:

 克隆存储库原点
$ git clone -o origin git@github.com:xyzw / myproject.git / var / lib / hudson / jobs / myjob / workspace
错误:克隆远程repo'origin'错误:无法克隆git@github.com :xyzw / myproject.git
错误:原因:执行git clone -o origin git@github.com错误:xyzw / myproject.git / var / lib / hudson / jobs / myjob / workspace
返回命令状态码128:克隆到/ var / lib / hudson / jobs / myjob / workspace ...
错误:找不到存储库。
致命:远程端意外挂起

尝试下一个存储库
错误:无法克隆存储库
致命错误:无法克隆
hudson.plugins。 git.GitException:无法克隆
在hudson.plugins.git.GitSCM $ 2.invoke(GitSCM.java:763)
at hudson.plugins.git.GitSCM $ 2.invoke(GitSCM.java:702 )
at hudson.FilePath.act(FilePath.java:756)
at hudson.FilePath.act(FilePath.java:738)
at hudson.plugins.git.GitSCM.checkout( GitSCM.java:702)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1181)
at hudson.model.AbstractBuild $ AbstractRunner.checkout(AbstractBuild.java:536)
在hudson.model.AbstractBuild $ AbstractRunner.run(AbstractBuild.java:424)
at hudson.model.Run.run(Run.java:1374)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild .java:467)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.jav a:145)

在其他线程中,有人建议创建一个不同的私钥 - 公钥对作为jenkins用户登录,但我甚至不知道如何在终端上这样做。我的意思是我知道如何使用'sudo'命令作为一个不同的用户登录,但我不认为人们正在使用sudo来做这件事。



非常感谢。


  1. 以hudson用户身份登录到hudson系统。

  2. 从终端窗口键入 ssh-keygen

  3. 将密码短语留空

  4. 用于私钥和公钥对。
  5. 以git用户身份登录到git系统。
  6. 将公钥从步骤4复制到git系统

  7. 从终端运行以下命令将hudson公钥添加到git授权密钥文件中。 cat {公钥文件}>>的〜/ .ssh / authorized_keys中。您应该先备份authorized_keys文件(如果它已经存在)。
  8. 通过回到哈德森系统并尝试 ssh {git system name} 。如果它工作,你应该能够连接而不提供密码。然后尝试克隆存储库并重新构建。

  9. 如果它不起作用,请务必从authorized_keys文件中删除密钥。


I am really stuck with this. I have created a job in Hudson and have configured in the same way as other jobs were. My project and build deliverables exist in Git. But every time I try to build it I am getting following errors:

Cloning repository origin
$ git clone -o origin git@github.com:xyzw/myproject.git /var/lib/hudson/jobs/myjob/workspace
ERROR: Error cloning remote repo 'origin' : Could not clone git@github.com:xyzw/myproject.git
ERROR: Cause: Error performing git clone -o origin git@github.com:xyzw/myproject.git /var/lib/hudson/jobs/myjob/workspace
Command returned status code 128: Cloning into /var/lib/hudson/jobs/myjob/workspace...
ERROR: Repository not found.
fatal: The remote end hung up unexpectedly

Trying next repository
ERROR: Could not clone repository
FATAL: Could not clone
hudson.plugins.git.GitException: Could not clone
    at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:763)
    at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:702)
    at hudson.FilePath.act(FilePath.java:756)
    at hudson.FilePath.act(FilePath.java:738)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:702)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1181)
    at hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:536)
    at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:424)
    at hudson.model.Run.run(Run.java:1374)
    at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:467)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:145) 

in other threads, some people recommended to create a different private-public key pair by login as a jenkins user but I dont even know how to do that in my terminal. I mean I know how to use 'sudo' command to login as a diffrent user but I dont think people were suggesting to do that using sudo.

many thanks.

解决方案

You probably need to set up keyless ssh access from the hudson server to the git server. To do this follow these steps:

  1. Log into the hudson system as the hudson user.
  2. From the terminal window type ssh-keygen
  3. Leave the passphrase blank
  4. Provide a filename for the private and public key pairs.
  5. Log into the git system as the git user.
  6. Copy the public key from step 4 to the git system
  7. From the terminal run the following command to add the hudson public key to the git authorized keys file. cat {public key file} >> ~/.ssh/authorized_keys. You should back up the authorized_keys file first if it already exists.
  8. Test this by going back to the hudson system and attempting to ssh {git system name}. If it worked you should be able to connect without providing a password. Then attempt to clone the repository and build again.
  9. If it doesn't work make sure to remove the key from the authorized_keys file.

这篇关于无法克隆存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆