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

3 篇文章 0 订阅
2 篇文章 0 订阅

原因:
本地没有更新到最新版本的项目,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 <remote> <branch>

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

    git branch --set-upstream-to=origin/<branch> 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、具体原因。需要后期继续研究,持续更新

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值