我一直在我没有管理员权限的机器上通过命令行远程处理我的项目,在运行 git push origin master
后,我收到以下错误消息:
(gnome-ssh-askpass:29241): Gtk-WARNING **: cannot open display:
我的 .git/config
文件包含以下内容:
[core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true [remote "origin"] fetch = +refs/heads/*:refs/remotes/origin/* url = https://username@github.com/username/repository.git [branch "master"] remote = origin merge = refs/heads/master
我之前收到 403 错误。关注评论here ,我将我的用户名放在远程 URL 中的 @ 符号之前,从那时起,我一直收到 Gtk 错误。
当我使用 ssh -X
登录机器并尝试推送时,出现以下错误:
X11 connection rejected because of wrong authentication.
(gnome-ssh-askpass:31922): Gtk-WARNING **: cannot open display:localhost:10.0
如果我将远程的 url 更改为 git@github.com:username/repository.git
,则错误为:
ssh: connect to host github.com port 22: Connection timed out
fatal: The remote end hung up unexpectedly
你知道如何解决这个问题吗?
最佳答案
我终于找到了解决问题的方法。正如所描述的那样here ,我在终端中运行了以下命令:
unset SSH_ASKPASS
然后运行 git push origin master
就可以正常工作了。您还可以将该行添加到您的 .bashrc
文件中。
关于git 产生 Gtk-WARNING : cannot open display,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16077971/