【问题标题】:I am getting error after "git push -u origin master" [duplicate]“git push -u origin master”后出现错误[重复]
【发布时间】:2019-08-27 22:45:58
【问题描述】:

您好,我在命令 git push -u origing master 后看到以下错误。有人可以帮忙吗

基本上我只是在尝试以下步骤

1) Go to github.com
2) Make repository called datasciencecoursera
3) Come back to git Bash tool
4) mkdir datasciencecoursera on local pc
5) cd to directory
6) git init
7) touch HelloWorld.md
8) git add HelloWorld.md
9) git commit -m "First comment"
10) git remote add origin https://github.com/adnan2911/datasciencecoursera.git
11) git push -u origin master

但我得到以下错误

adnan@AB-DESKTOP MINGW64 ~/datasciencecoursera (master)
$ git push -u origin master
To https://github.com/adnan2911/datasciencecoursera.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'https://github.com/adnan2911/datasciencecours
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

我试图搜索快进但无法理解,因为我对 git 的东西很陌生

【问题讨论】:

    标签: git github


    【解决方案1】:

    本教程不起作用,因为有一个HelloWorld.md(你可能一开始就不应该创建它)。克隆它,您将自动将远程添加到本地存储库:

    git clone https://github.com/adnan2911/datasciencecoursera
    

    【讨论】:

    • 我不得不在最后使用点,否则它仍然给我错误..所以我使用了下面的命令 git clone github.com/adnan2911/datasciencecoursera 。不过非常感谢
    • @user2774120 故意离开.git,否则这将是目录名称。
    猜你喜欢
    • 2018-07-30
    • 2011-08-07
    • 1970-01-01
    • 2020-07-30
    • 1970-01-01
    • 2020-11-23
    • 1970-01-01
    相关资源
    最近更新 更多