在我的 Jenkins 工作中,我按以下方式配置 git:
sh("git config user.email my.email@google.com")
sh("git config user.name my-user-name")
sh("git tag ${BUILD_NUMBER}")
sh("git push origin --tags")
Run Code Online (Sandbox Code Playgroud)
但是,在最后一行,当我尝试推送到我的存储库时,我收到有关存储库的以下错误:
fatal: could not read Username for 'http://my-git-repo.com:8000': No such device or address
Run Code Online (Sandbox Code Playgroud)
出了什么问题,如何将其推送到存储库?
You're looking for credential.username. I don't know about the passphrase, but if you dislike http://username:password@my-git-repo.com:8000 then put the credentials in your Jenkinsfile like so:
The second most common type of Credentials is "Username and Password" which can still be used in the
environmentdirective, but results in slightly different variables being set.Run Code Online (Sandbox Code Playgroud)environment { SAUCE_ACCESS = credentials('sauce-lab-dev') }This will actually set 3 environment variables:
Run Code Online (Sandbox Code Playgroud)SAUCE_ACCESS containing <username>:<password> SAUCE_ACCESS_USR containing the username SAUCE_ACCESS_PSW containing the password
credentialsis only available for Declarative Pipeline. For those using Scripted Pipeline, see the documentation for thewithCredentialsstep.
| 归档时间: |
|
| 查看次数: |
33683 次 |
| 最近记录: |