【问题标题】:fatal: could not read Username for Visual Studio<URL>: No such device or address致命:无法读取 Visual Studio<URL> 的用户名:没有这样的设备或地址
【发布时间】:2018-05-09 09:01:02
【问题描述】:

谁能帮我解决以下问题?我在詹金斯面对它。

+ git commit -m Added file
[PROD-Backup-NHS 9d4222d] Added file
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 newfile1
+ git push -u origin PROD-Backup-NHS
fatal: could not read Username for 'https://nestle-globe.visualstudio.com': 
No such device or address
Build step 'Execute shell' marked build as failure
Finished: FAILURE

使用的其他命令:

git branch -a
git checkout PROD-Backup-NHS
touch newfile1
ls -lrt ${WORKSPACE}
git config --global user.email "user.name@nestle.com"
git config --global user.name "user name"
git add .
git commit -m "Added file"
git push -u origin PROD-Backup-NHS

【问题讨论】:

  • 您没有使用 bitbucket,也许更改了标签?仔细检查 VSTS 地址是否正确。
  • 是的,我没有使用 bitbucket。我正在使用 VSTS 作为存储库。我检查了 URL,它只有一个正确。
  • 尝试通过 ssh 而不是 https 进行身份验证。
  • 是的,我尝试在 VSTS 中添加 ssh 密钥,但没有成功。不知道这里有什么问题。
  • git branch -a git checkout PROD-Backup-NHS touch newfile1 ls -lrt ${WORKSPACE} git config --global user.email "user.name@nestle.com" git config --global user.name "用户名" git add . git commit -m "添加的文件" git push -u origin PROD-Backup-NHS

标签: git version-control azure-devops


【解决方案1】:

推送到 VSTS git repo 时,您需要提供凭据。 可以在 repo URL 中添加 PAT 或备用凭据:

选项 1:在 VSTS git repo URL 中添加 PAT

网址的格式应该是:

https://Personal%20Access%20Token:{PAT}@nestle-globe.visualstudio.com/{projectname}/_git/{reponame}

选项 2:在 VSTS git repo URL 中添加备用凭据

网址的格式应该是:

https://{secondary username}:{password}@nestle-globe.visualstudio.com/{projectname}/_git/{reponame}

当您将 VSTS git repo 添加为本地 git repo 的远程 (origin) 时,您需要使用:

git remote add origin https://Personal%20Access%20Token:{PAT}@nestle-globe.visualstudio.com/{projectname}/_git/{reponame}

或者

git remote add origin https://{secondary username}:{password}@nestle-globe.visualstudio.com/{projectname}/_git/{reponame}

由于origin url 目前不包含凭据。如果您不想更改原始 url,您可以通过以下任意命令推送:

git push -u https://Personal%20Access%20Token:{PAT}@nestle-globe.visualstudio.com/{projectname}/_git/{reponame} PROD-Backup-NHS
git push -u https://{secondary username}:{password}@nestle-globe.visualstudio.com/{projectname}/_git/{reponame} PROD-Backup-NHS

【讨论】:

  • 获取和错误:git push -u https://{secondary username}:{password}@nestle-globe.visualstudio.com PROD-Backup-NHS 致命:无法访问 'https:// /{辅助用户名}:{password}@nestle-globe.visualstudio.com/': 端口号以'V'结尾
  • 对不起,忽略了 url 中的项目名称和 repo 名称。请改用git push -u https://{secondary username}:{password}@nestle-globe.visualstudio.com/{projectname}/_git/{reponame} PROD-Backup-NHS
  • @Bobby 你现在可以成功推送到 VSTS git repo 了吗?
  • 遇到同样的错误致命:无法访问“https://{secondary username}:{password}@nestle-globe.visualstudio.com/MyFirstProject/_git/test/PROD-Backup-NHS” : 端口号以“V”结尾
  • 当我通过 Jenkins 运行时收到如下错误:致命:存储库''https://{secondary username}:{password}@nestle-globe.visualstudio.com/MyFirstProject/_git/test / PROD-Backup-NHS' 未找到
猜你喜欢
  • 2013-09-24
  • 2019-06-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-03-22
  • 2017-05-28
  • 1970-01-01
相关资源
最近更新 更多