无法在此计算机上推送至GitHub

6
我在家里克隆了我的GitHub存储库,显然搞砸了什么。无论如何,我做了很多更改,否则我会清除目录并重新做一遍。
首先,当我执行ssh git@github.com时,我得到以下内容: PTY分配请求在通道0上失败 错误:您已成功验证,但GitHub不提供Shell访问 与github.com的连接已关闭。 我收到一个错误提示,但它说我已经成功验证?
git add .
git commit -a -m "hello"
git push origin master
[master 74a5e82] hello
3 files changed, 45 insertions(+), 12 deletions(-)
fatal: The remote end hung up unexpectedly

这显然行不通。而且我对git很陌生,所以现在当我尝试提交时会出现以下情况:

git add .
git commit -a -m "hello"
git push origin master
# On branch master
nothing to commit (working directory clean)
fatal: The remote end hung up unexpectedly

最后,git pull是什么?
$ git pull
You asked me to pull without telling me which branch you
want to merge with, and 'branch.master.merge' in
your configuration file does not tell me either.    Please
specify which branch you want to merge on the command line and
try again (e.g. 'git pull <repository> <refspec>').
See git-pull(1) for details.

If you often merge with the same branch, you may want to
configure the following variables in your configuration
file:

branch.master.remote = <nickname>
branch.master.merge = <remote-ref>
remote.<nickname>.url = <url>
remote.<nickname>.fetch = <refspec>

See git-config(1) for details.

这是我的.git/config文件。
[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
        ignorecase = true
[branch "master"]
[remote "origin"]
        url = git://github.com/my/project.git
        fetch = +refs/heads/*:refs/remotes/origin/*

那个url变量实际上指向了我的正确git url。谢谢。

1个回答

9
在您的 .git/config 中使用 ssh:// ,而不是 git:// 。 git:// 仅用于克隆存储库。来自我的 libcloud 存储库 - 我出于与此帖子无关的原因使用 "mothership":
[remote "mothership"]
    url = ssh://git@github.com/jedsmith/libcloud.git
    fetch = +refs/heads/*:refs/remotes/origin/*

线索应该是您正在使用ssh测试您的连接性...

一个简单的解决方法是将以下内容添加到您的 ~/.gitconfig 文件中:https://gist.github.com/412f0b1c8841cceed750 - sarahhodne

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接