致命:无法读取用户名,没有这样的设备 [英] fatal: could not read Username for, No such device

查看:128
本文介绍了致命:无法读取用户名,没有这样的设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Jenkins工作中,我通过以下方式配置git:

In my Jenkins job, I am configuring git in the following way:

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")

但是,在最后一行,当我尝试推送到存储库时,出现有关存储库的以下错误:

However, on the last line, when I try to push to my repository, I get the following error about the repository:

fatal: could not read Username for 'http://my-git-repo.com:8000': No such device or address

出什么问题了,如何将其推送到存储库中?

What's wrong and how can I make it push to the repository?

推荐答案

您在寻找 .我不知道密码短语,但是如果您不喜欢http://username:password@my-git-repo.com:8000,则将凭据放入您的 Jenkinsfile 就像这样:

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:

第二种最常见的凭据类型是用户名和密码" 仍可以在environment指令中使用,但会导致 设置的变量略有不同.

The second most common type of Credentials is "Username and Password" which can still be used in the environment directive, but results in slightly different variables being set.

environment {
   SAUCE_ACCESS = credentials('sauce-lab-dev')
}

这实际上将设置3个环境变量:

This will actually set 3 environment variables:

SAUCE_ACCESS containing <username>:<password>
SAUCE_ACCESS_USR containing the username
SAUCE_ACCESS_PSW containing the password

credentials仅可用于声明性管道.对于那些 使用脚本化管道,请参见 withCredentials步骤.

credentials is only available for Declarative Pipeline. For those using Scripted Pipeline, see the documentation for the withCredentials step.

这篇关于致命:无法读取用户名,没有这样的设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆