当我试图在Windows上使用git Bash拉代码时,我有以下问题:

fatal: could not read Username for 'https://github.com': No such file or directory

我已经尝试实现这里提供的可接受的解决方案:

当推送提交Github时错误:致命:无法读取用户名

然而,问题仍然存在。

在添加/删除原点后,我仍然得到相同的错误。

你能给我一些建议吗?

谢谢!


当前回答

从Android Studio终端执行git拉取 例如:test@test:~/StudioProjects/dummy-project-android$ git 添加用户名 例如:test@test:~/StudioProjects/dummy-project-android$ "username" 添加用户密码 “https://dummy-project-android@git.com”的密码:“Password”

之后,我们就可以进行剩下的手术了

其他回答

当试图克隆无效的HTTP URL时,也会发生此错误。例如,这是我在试图克隆一个GitHub URL时得到的错误,这是几个字符:

$ git clone -v http://github.com/username/repo-name.git
Cloning into 'repo-name'...
Username for 'https://github.com': 
Password for 'https://github.com': 
remote: Repository not found.
fatal: Authentication failed for 'https://github.com/username/repo-name.git/'

但是,它实际上发生在Emacs内部,所以Emacs中的错误看起来是这样的:

fatal: could not read Username for ’https://github.com’: No such device or address

因此,它没有给出一个有用的错误,告诉我那个URL上没有这样的回购,而是给了我这个错误,让我徒劳地追逐,直到我最终意识到URL是错误的。

这是git 2.7.4版本。

我在这里张贴这个,因为一个月前发生在我身上的事情,刚刚又发生了一次,让我再次陷入同样的徒劳。>:(

像这样替换你的远程url:

git remote set-url origin https://<username>@github.com/<username>/<repo>.git

我在这里找到了答案:

编辑~ /。并添加以下内容:

[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

从Android Studio终端执行git拉取 例如:test@test:~/StudioProjects/dummy-project-android$ git 添加用户名 例如:test@test:~/StudioProjects/dummy-project-android$ "username" 添加用户密码 “https://dummy-project-android@git.com”的密码:“Password”

之后,我们就可以进行剩下的手术了