7

我在家里克隆了我的 GitHub 存储库,显然搞砸了。无论如何,我做了很多更改,或者我会清除目录并重新执行所有操作。

首先,当我这样做时,ssh git@github.com我得到以下信息:

PTY allocation request failed on channel 0 ERROR: Hi asdfadfs! You've successfully authenticated, but GitHub does not provide shell access Connection to github.com closed.

我收到一个错误,但它说我已成功通过身份验证?

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。谢谢。

4

1 回答 1

10

ssh://在您的 .git/config 中使用,而不是git://. git://仅用于克隆存储库。直接来自我的 libcloud 存储库——我使用“mothership”的原因与这篇文章无关:

[remote "mothership"]
    url = ssh://git@github.com/jedsmith/libcloud.git
    fetch = +refs/heads/*:refs/remotes/origin/*

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

于 2009-09-30T02:50:17.400 回答