Da'sBlog

git-pull错误refusing to merge unrelated histories

在服务器创建好后 应该先拉到本地 再推。

提前推是会报错的。

如果本地已经创建项目 需要合并下。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
H:\zcll>git remote add zcll https://git.coding.net/da_/zcll.git
H:\zcll>git push -u zcll master
To https://git.coding.net/da_/zcll.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://git.coding.net/da_/zcll.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.
H:\zcll>git pull zcll master
From https://git.coding.net/da_/zcll
* branch master -> FETCH_HEAD
fatal: refusing to merge unrelated histories
H:\zcll>git pull zcll master --allow-unrelated-histories
From https://git.coding.net/da_/zcll
* branch master -> FETCH_HEAD
Merge made by the 'recursive' strategy.
README.md | 1 +
1 file changed, 1 insertion(+)
create mode 100644 README.md
H:\zcll>git push -u zcll master
Counting objects: 148, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (140/140), done.
Writing objects: 100% (148/148), 3.35 MiB | 673.00 KiB/s, done.
Total 148 (delta 19), reused 0 (delta 0)
remote: Resolving deltas: 100% (19/19), done.
To https://git.coding.net/da_/zcll.git
857afd6..252f11c master -> master
Branch master set up to track remote branch master from zcll.
坚持原创技术分享,您的支持将鼓励我继续创作!