【问题标题】:Push existing git repo to github: system cannot make a pull将现有的 git repo 推送到 github:系统无法拉取
【发布时间】:2012-10-03 13:24:28
【问题描述】:

我有一个使用 git 的本地仓库。现在我想把它推送到我的 github 仓库。 我按照在线说明在 web 目录中添加远程仓库:

git远程添加github git@github.com:[用户名]/[repo_name].git

之后我进行推送(git push -u github master),终端响应建议我进行拉取以避免非快进。

然后我尝试拉一下: (第一次尝试)

git pull -u github master (第二次尝试) git pull github master

两者都返回致命:呃哦。您的系统根本没有报告任何 Git 命令。

我已经检查了 .git/config 文件,远程 git 已经存在。为什么 git 能推,不能拉。

我的 .git/config 文件是:

[remote "github"]
        url = git@github.com:[username]/[repo_name].git
        fetch = +refs/heads/*:refs/remotes/github/*

【问题讨论】:

  • 你在 github 上有那个名字的 repo 吗?
  • 第二个命令 (git pull) 中的 -u 应该做什么?

标签: git github


【解决方案1】:

确保这不是路径问题,如 this thread 中所述(适用于 Windows,但也适用于其他操作系统)。
还要检查您是否没有任何活动的git alias,这可能会阻止git pull 正常工作。


关于路径问题,OP aladine 在 cmets 中确认:

我发现重新安装 git 后,它可以正常工作了。

【讨论】:

  • 谢谢,我发现重新安装git后,它可以正常工作了。
  • @aladine 非常好。为了提高知名度,我已将您的结论包含在答案中。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2021-09-11
  • 1970-01-01
  • 2019-06-15
  • 1970-01-01
  • 2020-04-14
  • 2011-11-24
  • 1970-01-01
相关资源
最近更新 更多