使用Jenkins配置本地git

时间:2017-06-20 08:25:58

标签: git jenkins

在我们的组织中,我们有本地托管的git。对于我的项目,我需要在jenkins的帮助下实现CI。我知道用GitHub配置jenkins但不确定用本地git配置它。

Repository URL我应该提供什么?

运行git remote show origin

在我的存储库中的

命令我有类似下面的内容

WARNING: previous mirror push of repo 'OPT' to host 'tregit1' failed, status is:
2017-06-16.19:28:39     31417   ssh: connect to host 10.9.100.31 port 22: No route to host
2017-06-16.19:28:39     31417   fatal: Could not read from remote repository.
2017-06-16.19:28:39     31417
2017-06-16.19:28:39     31417   Please make sure you have the correct access rights
2017-06-16.19:28:39     31417   and the repository exists.
----------
* remote origin
  Fetch URL: gitbox:OPT
  Push  URL: gitbox:OPT
  HEAD branch: master
  Remote branch:
    master tracked
  Local branch configured for 'git pull':
    master merges with remote master
  Local ref configured for 'git push':
    master pushes to master (up to date)

并且为了运行这个git remote -v命令,输出就像

origin  gitbox:OPT (fetch)
origin  gitbox:OPT (push)

我尝试将Repository URL作为gitbox:OPT,但一旦我输入gitbox:OPT

,Jenkins就会给出以下错误
Failed to connect to repository : Command "git ls-remote -h gitbox:OPT HEAD" 
returned status code 128:
stdout: 
stderr: ssh: Could not resolve hostname gitbox: Temporary failure in name resolution 
fatal: Could not read from remote repository.

Please make sure you have the correct access rights

并且存储库存在。

任何人都可以告诉我在Git URL中提供什么吗?

1 个答案:

答案 0 :(得分:0)

简单:当给定别名时,ssh将查找%HOME%/.ssg/config

与“config”相同,而不是“conf”。

确保HOME已定义(C:\Users\AY)。并且您的ssh配置文件名为“config”。

同时测试ssh -i C:\Users\AY\.ssh\anish -T gitolite@10.47.52.185是否有效。

  

我使用了ubuntu中的gitolite.pub,我在windows中创建了anish.pub并将其添加到gitolite并更改了conf/gitolite.conf,如下所示repo

gitolite-admin RW+ = gitolite 
repo testing 
  RW+ = @all 
repo bigfastblog 
  RW+ = anish 

确保将gitolite.conf推送回Ubuntu服务器,并检查~gitolite/.ssh/authorized_keys是否列出anish.pub内容。
此外,Windows HOME/.ssh应包含anish.pubanish(私钥)

  

最终能够克隆:HOME环境变量存在问题。