github 本地上传远程库失败(error: failed to push some refs to '~~~~~')

原因:
本地没有更新到最新版本的项目,github远程资源和本地不一致。

解决过程:
1、将远程最新项目下载到本地

(1)尝试git pull,出错

Sunshine@Sunshine-pc MINGW64 /d/gitProjects/DataProcess (master)
$ git pull
warning: no common commits
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), done.
From github.com:sunmingming99/DataProcess
 * [new branch]      master     -> origin/master
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  

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

    git branch --set-upstream-to=origin/ master

(2)尝试git pull origin,依然不正确

Sunshine@Sunshine-pc MINGW64 /d/gitProjects/DataProcess (master)
$ git pull origin
You asked to pull from the remote 'origin', but did not specify
a branch. Because this is not the default configured remote
for your current branch, you must specify a branch on the command line.

Sunshine@Sunshine-pc MINGW64 /d/gitProjects/DataProcess (master)
$

(3)git pull --rebase origin master,正确

Sunshine@Sunshine-pc MINGW64 /d/gitProjects/DataProcess (master)
$ git pull --rebase origin master
From github.com:sunmingming99/DataProcess
 * branch            master     -> FETCH_HEAD
First, rewinding head to replay your work on top of it...
Applying: commite all files

2、push 到远程库

Sunshine@Sunshine-pc MINGW64 /d/gitProjects/DataProcess (master)
$ git push -u origin master
Enumerating objects: 31, done.
Counting objects: 100% (31/31), done.
Delta compression using up to 4 threads.
Compressing objects: 100% (28/28), done.
Writing objects: 100% (30/30), 16.66 KiB | 898.00 KiB/s, done.
Total 30 (delta 14), reused 0 (delta 0)
remote: Resolving deltas: 100% (14/14), done.
To github.com:sunmingming99/DataProcess.git
   f138343..2fc39c5  master -> master
Branch 'master' set up to track remote branch 'master' from 'origin'.

 

3、具体原因。需要后期继续研究,持续更新

你可能感兴趣的:(git,github,源码管理)