git failed to push some refs to

Posted meijsuger

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了git failed to push some refs to相关的知识,希望对你有一定的参考价值。

[email protected]201903201424 MINGW64 /d/IdeaProject/github/netty-guide (master)
$ git pull
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.

    git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

    git branch --set-upstream-to=nettyGuide/<branch> master


[email protected]-201903201424 MINGW64 /d/IdeaProject/github/netty-guide (master)
$ git push
fatal: No configured push destination.
Either specify the URL from the command-line or configure a remote repository using

    git remote add <name> <url>

and then push using the remote name

    git push <name>


[email protected]-201903201424 MINGW64 /d/IdeaProject/github/netty-guide (master)
$ git push nettyGuide
fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream nettyGuide master


[email protected]-201903201424 MINGW64 /d/IdeaProject/github/netty-guide (master)
$ git push --set-upstream nettyGuide master

To https://gitee.com/ghostsugar/nettyGuide.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to https://gitee.com/ghostsugar/nettyGuide.git
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.

[email protected]-201903201424 MINGW64 /d/IdeaProject/github/netty-guide (master)
$

[email protected]-201903201424 MINGW64 /d/IdeaProject/github/netty-guide (master)
$ git pull
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.

    git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

    git branch --set-upstream-to=nettyGuide/<branch> master


[email protected]-201903201424 MINGW64 /d/IdeaProject/github/netty-guide (master)
$ git pull nettyGuide master
warning: no common commits
remote: Enumerating objects: 4, done.
remote: Counting objects: 100% (4/4), done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 4 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (4/4), done.
From https://gitee.com/ghostsugar/nettyGuide
 * branch            master     -> FETCH_HEAD
 * [new branch]      master     -> nettyGuide/master
fatal: refusing to merge unrelated histories

[email protected]-201903201424 MINGW64 /d/IdeaProject/github/netty-guide (master)
$ git push
fatal: No configured push destination.
Either specify the URL from the command-line or configure a remote repository using

    git remote add <name> <url>

and then push using the remote name

    git push <name>


[email protected]-201903201424 MINGW64 /d/IdeaProject/github/netty-guide (master)
$ git commit
On branch master
nothing to commit, working tree clean

[email protected]-201903201424 MINGW64 /d/IdeaProject/github/netty-guide (master)
$ git push nettyGuide
fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream nettyGuide master


[email protected]-201903201424 MINGW64 /d/IdeaProject/github/netty-guide (master)
$ ^C

[email protected]-201903201424 MINGW64 /d/IdeaProject/github/netty-guide (master)
$   git push --set-upstream nettyGuide master
To https://gitee.com/ghostsugar/nettyGuide.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to https://gitee.com/ghostsugar/nettyGuide.git
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: git pull ...) before pushing again.
hint: See the Note about fast-forwards in git push --help for details.

[email protected]-201903201424 MINGW64 /d/IdeaProject/github/netty-guide (master)
$ git pull
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.

    git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

    git branch --set-upstream-to=nettyGuide/<branch> master


[email protected]-201903201424 MINGW64 /d/IdeaProject/github/netty-guide (master)
$ git pull nettyGuide master
From https://gitee.com/ghostsugar/nettyGuide
 * branch            master     -> FETCH_HEAD
fatal: refusing to merge unrelated histories

[email protected]-201903201424 MINGW64 /d/IdeaProject/github/netty-guide (master)
$   git push --set-upstream nettyGuide master
To https://gitee.com/ghostsugar/nettyGuide.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to https://gitee.com/ghostsugar/nettyGuide.git
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: git pull ...) before pushing again.
hint: See the Note about fast-forwards in git push --help for details.

[email protected]-201903201424 MINGW64 /d/IdeaProject/github/netty-guide (master)

出现错误的主要原因是github中的README.md文件不在本地代码目录中,可以通过如下命令进行代码合并【注:pull=fetch+merge]
$ git pull
--rebase nettyGuide master From https://gitee.com/ghostsugar/nettyGuide * branch master -> FETCH_HEAD First, rewinding head to replay your work on top of it... Applying: io [email protected]-201903201424 MINGW64 /d/IdeaProject/github/netty-guide (master) $ git push -u nettyGuide master Enumerating objects: 23, done. Counting objects: 100% (23/23), done. Delta compression using up to 4 threads Compressing objects: 100% (15/15), done. Writing objects: 100% (22/22), 5.69 KiB | 1.90 MiB/s, done. Total 22 (delta 3), reused 0 (delta 0) remote: Powered By Gitee.com To https://gitee.com/ghostsugar/nettyGuide.git f3be308..8939350 master -> master Branch master set up to track remote branch master from nettyGuide.

 

以上是关于git failed to push some refs to的主要内容,如果未能解决你的问题,请参考以下文章

git push错误failed to push some refs to的解决方法

git 无法push failed to push some refs to

git failed to push some refs to

Git上传提示error: failed to push some refs to

git push origin master出错:error: failed to push some refs to

git push报错error: failed to push some refs to 'git@github.com: