我有一个使用 git 的本地存储库。现在我想将它推送到我的 github 存储库。 我按照在线说明在 Web 目录中添加远程存储库:
git remote add github [email protected]:[username]/[repo_name].git
之后我进行推送(git push -u github master),终端响应建议我进行 pull 以避免非快进。
然后我尝试 pull : (第一次尝试)
git pull -u github master (second try) git pull github master
两者都返回致命:呃哦。您的系统根本报告没有 Git 命令。
我已经检查了 .git/config 文件,远程 git 已经在那里。为什么 git 可以推送但不能 pull 。
我的 .git/config 文件是:
[remote "github"]
url = <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="99fef0edd9fef0edf1ecfbb7faf6f4" rel="noreferrer noopener nofollow">[email protected]</a>:[username]/[repo_name].git
fetch = +refs/heads/*:refs/remotes/github/*
最佳答案
确保这不是路径问题,如 this thread 中所述。 (适用于 Windows,但也适用于其他操作系统)。
另请检查您是否没有任何事件的 git 别名
,这可能会阻止 git pull
正常工作。
关于路径问题,OP aladine在评论中确认:
I discover that after I reinstall git, it works as normal.
关于git - 将现有的 git 存储库推送到 github : system cannot make a pull,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12674930/