今天对代码进行了修改优化,然后往往远程push,但push后报错了
1、报错详情
To https://amc-msra.visualstudio.com/trading-algo/_git/real-trading
! [rejected] master -> dev-gaochao (fetch first)
error: failed to push some refs to 'https://amc-msra.visualstudio.com/trading-algo/_git/real-trading'
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.
2、问题原因
我之前在git上手动删除了连个文件,未同步到本地,所以线上线下就对不上了。
3、解决方案
- 将线上、线下代码进行合并
git pull origin master
remote: Enumerating objects: 20, done.
remote: Counting objects: 100% (20/20), done.
remote: Compressing objects: 100% (9/9), done.
remote: Total 14 (delta 1), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (14/14), 1.81 KiB | 77.00 KiB/s, done.
From github.com:lck-001/Flink
branch master -> FETCH_HEAD
d4ceee4…b391359 master -> origin/master
Merge made by the ‘ort’ strategy.
…/src/main/resources/GeoLite2-City.mmdb | Bin 63565553 -> 0 bytes
…/src/main/resources/ceph-config.yml | 23 ---------------------
2 files changed, 23 deletions(-)
delete mode 100644 data-flink/data-flink-ceph/src/main/resources/GeoLite2-City.mmdb
delete mode 100644 data-flink/data-flink-ceph/src/main/resources/ceph-config.yml
- 然后再进行push
git push origin master
- 成功:
Enumerating objects: 45, done.
Counting objects: 100% (45/45), done.
Delta compression using up to 8 threads
Compressing objects: 100% (24/24), done.
Writing objects: 100% (41/41), 10.74 KiB | 2.15 MiB/s, done.
Total 41 (delta 0), reused 0 (delta 0), pack-reused 0
To github.com:lck-001/Flink.git
b391359…efb54ce master -> master
在尝试将本地代码推送到远程仓库时遇到了错误,提示远程仓库有更新未同步到本地。通过执行`git pull origin master`命令合并远程与本地代码,解决了冲突。之后成功执行`git push origin master`将代码推送到远程仓库。
2359

被折叠的 条评论
为什么被折叠?



