我已经在我的jenkins
上安装了centos7 server
,并尝试构建一个maven
构建。创建了一个新的maven构建工作,在SCM
我试图从github
中提取代码,但它显示了一个错误,如...
Failed to connect to repository : Command "git ls-remote -h https://github.com/example.git HEAD" returned status code 128: stdout: stderr: remote: Invalid username or password. fatal: Authentication failed for 'https://github.com/example.git/'
我还为我的SSH
设置了github
公钥。我不知道如何解决这个问题。任何人都帮助我。谢谢你。
我也为我的github设置了一个SSH公钥
这对HTTPS URL没有任何影响:SSH密钥被忽略。
检查您是否有可能缓存凭据的git凭证帮助程序(GitHub用户名/密码)
git config credential.helper
我建议(作为in this answer)将其设置为gnome-keyring
:
git config --global credential.helper gnome-keyring
然后从命令行再次尝试你的git ls-remote
:
git ls-remote https://<yourUsername>@github.com/<yourUsername>/<yourRepo.git>
这应该提示您的GitHub用户名/密码。一旦进入,第二个git ls-remote
不应再问你的凭据。
从那里开始,Jenkins的SCM流程,只要詹金斯说你的帐户运行,就应该有效。