Github git push error
Error list :
error: failed to push some refs to 'github.com:id/AutoTrade.git'
fatal: refusing to merge unrelated histories
command for issue )
git pull origin master --allow-unrelated-histories
This command option is used to store the history of a project that already exists. In other words, git basically rejects when merging two heterogeneous projects that do not have related records.
I think it got twisted somewhere because I repeated git add and git init.
The conclusion is solved.
step )
kw@ig-ui-MacBookAir autotrade % git init
kw@ig-ui-MacBookAir autotrade % git remote add origin git@github.com:id/AutoTrade.git
kw@ig-ui-MacBookAir autotrade % git add .
kw@ig-ui-MacBookAir autotrade % git commit -m "first"
Error 1) error: failed to push some refs to 'github.com:id/AutoTrade.git'
kw@ig-ui-MacBookAir autotrade % git push origin master
To github.com:id/AutoTrade.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'github.com:id/AutoTrade.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.
I didn't "git pull", so I think this issue occurred.
So, I did "git pull". -> Error 2 Step
Error 2) Merge made by the 'recursive' strategy.
kw@ig-ui-MacBookAir autotrade % git pull git@github.com:id/AutoTrade.git master
From github.com:id/AutoTrade
* branch master -> FETCH_HEAD
hint: Pulling without specifying how to reconcile divergent branches is
hint: discouraged. You can squelch this message by running one of the following
hint: commands sometime before your next pull:
hint:
hint: git config pull.rebase false # merge (the default strategy)
hint: git config pull.rebase true # rebase
hint: git config pull.ff only # fast-forward only
hint:
hint: You can replace "git config" with "git config --global" to set a default
hint: preference for all repositories. You can also pass --rebase, --no-rebase,
hint: or --ff-only on the command line to override the configured default per
hint: invocation.
fatal: refusing to merge unrelated histories
… "git pull" is not executed… what the issue….
fatal: refusing to merge unrelated histories
Solve)
kw@ig-ui-MacBookAir autotrade % git pull origin master --allow-unrelated-histories
From github.com:id/AutoTrade
* branch master -> FETCH_HEAD
hint: Pulling without specifying how to reconcile divergent branches is
hint: discouraged. You can squelch this message by running one of the following
hint: commands sometime before your next pull:
hint:
hint: git config pull.rebase false # merge (the default strategy)
hint: git config pull.rebase true # rebase
hint: git config pull.ff only # fast-forward only
hint:
hint: You can replace "git config" with "git config --global" to set a default
hint: preference for all repositories. You can also pass --rebase, --no-rebase,
hint: or --ff-only on the command line to override the configured default per
hint: invocation.
Merge made by the 'recursive' strategy.
kw@ig-ui-MacBookAir autotrade % git push origin master
Enumerating objects: 15, done.
Counting objects: 100% (15/15), done.
Delta compression using up to 8 threads
Compressing objects: 100% (13/13), done.
Writing objects: 100% (14/14), 7.16 KiB | 3.58 MiB/s, done.
Total 14 (delta 1), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (1/1), done.
To github.com:id/AutoTrade.git
412ec51..2332532 master -> master
<pull option>
--allow-unrelated-histories
The conclusion is solved, so let's just use it.
#git #github #issue #error #fatal: refusing to merge unrelated histories #python #c++ #c
No comments:
Post a Comment