当我试图在Windows上使用git Bash拉代码时,我有以下问题:
fatal: could not read Username for 'https://github.com': No such file or directory
我已经尝试实现这里提供的可接受的解决方案:
当推送提交Github时错误:致命:无法读取用户名
然而,问题仍然存在。
在添加/删除原点后,我仍然得到相同的错误。
你能给我一些建议吗?
谢谢!
当我试图在Windows上使用git Bash拉代码时,我有以下问题:
fatal: could not read Username for 'https://github.com': No such file or directory
我已经尝试实现这里提供的可接受的解决方案:
当推送提交Github时错误:致命:无法读取用户名
然而,问题仍然存在。
在添加/删除原点后,我仍然得到相同的错误。
你能给我一些建议吗?
谢谢!
当前回答
我在这里找到了答案:
编辑~ /。并添加以下内容:
[url "git@github.com:"]
insteadOf = https://github.com/
虽然它解决的问题不同,但错误代码是一样的…
其他回答
[SSH] executing...
fatal: could not read Username for 'https://github.com': No such device or address
[SSH] completed
[SSH] exit-status: 1
Build step 'Execute shell script on remote host using ssh' marked build as failure
Finished: FAILURE
索尔:- 如果存储库是私有的,它也属于另一个人或组织,并且你是该存储库的贡献者,那么你可以从Jenkins作业中运行git命令,它不会提示你输入用户名和密码。
https://username:token@github.com/accountname/reponame.git
我在这里找到了答案:
编辑~ /。并添加以下内容:
[url "git@github.com:"]
insteadOf = https://github.com/
虽然它解决的问题不同,但错误代码是一样的…
从Android Studio终端执行git拉取 例如:test@test:~/StudioProjects/dummy-project-android$ git 添加用户名 例如:test@test:~/StudioProjects/dummy-project-android$ "username" 添加用户密码 “https://dummy-project-android@git.com”的密码:“Password”
之后,我们就可以进行剩下的手术了
我正在使用GitHub操作,其中作业被配置为完成任务。该解决方案适用于所有git命令执行环境发生变化的ci (Jenkins、Travis、Circle)。
job1: 使用github actions actions/checkout@v2使用个人访问令牌(PAT)检出存储库,作业成功完成,存储库克隆。
job2: 使用命令git Fetch——tags获取标签。由于同样的错误,作业失败
致命:无法读取用户名https://github.com':没有这样的文件或目录
失败原因:当作业发生变化时,命令运行环境也发生了变化,即使存储库存在,但需要提供github凭据来获取标记。
解决方案:在获取作业b2中的标记之前添加此命令
Git配置remote.origin.url 'https://${{your_personal_access_token}}@github.com/${{github。库}}’
注意:${{expression}}是github actions yaml syntex,用于发现环境变量/运行表达式。
对于那些在Jenkins管道中得到这个错误的人,可以使用SSH代理插件来修复。然后像这样包装你的git命令:
sshagent(['my-ssh-key']) {
git remote set-url origin git@github.com:username/reponame.git
sh 'git push origin branch_name'
}