简体   繁体   English

无法使用 Jenkins 将更改推送到 git 存储库

[英]Not able to push changes to git repository using Jenkins

I have created Jenkins pipeline for building code by cloning from git.我已经创建了 Jenkins 管道,用于通过从 git 克隆来构建代码。 I am able to clone repo, after building I want to push some files to git repo.我能够克隆 repo,在构建后我想将一些文件推送到 git repo。 I gave git credentials in Jenkins, still I am getting below error while pushing code.我在 Jenkins 中提供了 git 凭据,但在推送代码时仍然出现错误。

fatal: could not read Username for 'https://bitbucket.xyz.com': No such device or address致命:无法读取“https://bitbucket.xyz.com”的用户名:没有这样的设备或地址

I have seen many answers in google and tried that did not help me.我在谷歌上看到了很多答案,并尝试过对我没有帮助。 Any ideas how we can solve this problem?有什么想法可以解决这个问题吗?

See if you can follow Handling credentials / Usernames and passwords and use environment variables.看看您是否可以遵循处理凭据/用户名和密码并使用环境变量。

Jenkins' declarative Pipeline syntax has the credentials() helper method (used within the environment directive) which supports secret text, username and password, as well as secret file credentials Jenkins 的声明式流水线语法具有 credentials() 辅助方法(在 environment 指令中使用),它支持秘密文本、用户名和密码,以及秘密文件凭据

You can see a concrete example here .你可以在这里看到一个具体的例子

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM