加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

Jenkins配置git连接github验证失败解决办法

(2015-05-29 18:47:06)
分类: Testing

一、问题现象:

配置Jenkins使用git,连接github,验证失败。日志如下:

Failed to connect to repository : Command "git ls-remote -h git@github.com:***********/game-of-life.git HEAD" returned status code 128:
stdout: 
stderr: Host key verification failed. 
fatal: The remote end hung up unexpectedly

二、解决办法:

***Set up SSH for Git on Linux***

Step 1. Ensure you have an SSH client installed

# ssh -v


Step 2. Set up your default identity

1)Open a terminal in your local system.

2)Enter ssh-keygen at the command line.

The command prompts you for a file where you want to save the key. If the .ssh directory doesn't exist, the system creates one for you.

# ssh-keygen

3)Press the Enter or Return key to accept the default location.

4)Enter and re-enter a passphrase when prompted.


Step 3. Start the ssh-agent and load your keys

1)Open a terminal window and enter the ps -e | grep ssh-agent command to see if the agent is running:

# ps -ef  | grep ssh-agent

2)If the agent isn't running, start it manually with the following command:

# ssh-agent /bin/bash

# ps -ef  | grep ssh-agent

3)Load your new identity into the ssh-agent management program using the ssh-add command.

# ssh-add ~/.ssh/id_rsa

Identity added: /root/.ssh/id_rsa (/root/.ssh/id_rsa)

4)Use the ssh-add command to list the keys that the agent is managing.

# ssh-add -l

2048 64:8f:33:66:86:6d:4b:8c:c1:d8:72:81:b1:8e:19:7e /root/.ssh/id_rsa (RSA)


Step 4. Install the public key on your Bitbucket account

1)Open a browser and log into Bitbucket.

2)Choose avatar > Manage Account from the application menu.  The system displays the Account settings page.

3)Click SSH keys.  The SSH Keys page displays. It shows a list of any existing keys. Then, below that, a dialog for labeling and entering a new key.

4)Back in your terminal window, copy the contents of your public key file.For example, in Linux you can cat the contents.

cat ~/.ssh/id_rsa.pub

5)Back in your browser, enter a Label for your new key, for example, Default public key.

6)Paste the copied public key into the SSH Key field.

7)Press Add key. The system adds the key to your account.  Bitbucket sends you an email to confirm addition of the key.


Step 5. Change your repo from HTTPS to the SSH protocol

The URL you use for a repo depends on which protocol you are using, HTTPS or SSH.  

The Bitbucket repository Overview page has a quick way for you to see these URLS for your game-of-life repo.  

on the repo's Overview page look for the Clone button.


0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有