gpt4 book ai didi

git - 无法在此框上推送到 GitHub

转载 作者:太空狗 更新时间:2023-10-29 12:59:33 26 4
gpt4 key购买 nike

我在家里克隆了我的 GitHub 存储库,显然搞砸了。不管怎样,我做了很多更改,或者我会清除目录并重新做一遍。

首先,当我执行 ssh git@github.com 时,我得到以下信息:

channel 0 上的 PTY 分配请求失败
错误:您好 asdfadfs!您已成功通过身份验证,但 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。谢谢。

最佳答案

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

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

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

关于git - 无法在此框上推送到 GitHub,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1495872/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com