从jenkinsdocker不工作的git推
我正在运行一个Jenkins泊坞窗图像,并尝试通过GitHub做一个git推送。
我在PostSteps(Execute Shell)和Git Publisher的PostBuild Actions做了git commit。
在jenkins有什么特殊的身份validation?
我无法弄清楚。
非常感谢。
错误:
无法将分支主机推送到原点hudson.plugins.git.GitException:命令“git push HEAD:master -f”返回状态码128:stdout:stderr:remote:无效的用户名或密码。 致命:身份validation失败,在org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1903)
启用双因素身份validation(2FA)后,尝试使用git clone
, git fetch
, git pull
或git push
时可能会看到类似下面的内容:
$ git push origin master Username for 'https://github.com': your_user_name Password for 'https://your_user_name@github.com': remote: Invalid username or password. fatal: Authentication failed for 'https://github.com/your_user_name/repo_name.git/'
原因?
从GitHub帮助文档 :
启用2FA后,您将需要input个人访问令牌,而不是2FA代码和GitHub密码。
例如,当你使用命令行上的Git使用
git clone
,git fetch
,git pull
或git push
等命令访问存储库时,必须在提示input用户名和密码时提供GitHub用户名和个人访问令牌。 命令行提示符不会指定您要求input密码时input个人访问令牌。
解答:
- 生成个人访问令牌 。 (有关为命令行创build个人访问令牌的详细指南。)
- 复制个人访问令牌。
- 重新尝试您正在尝试的命令,并使用个人访问令牌代替您的密码。
相关问题: https : //stackoverflow.com/a/21374369/101662