1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ObsidianとGitの連携中にfatal: refusing to merge unrelated historiesエラーが出た。

Last updated at Posted at 2025-05-25

原因

obsidianの初期コミットとgithub自体の初期コミットが別々で行われてしまったため。無関係な歴史同士を結合出来ないよというエラー。

解決方法

GitBashで「無関係な歴史」を許可してマージする。

1.該当フォルダをターミナルで開く

コマンドは省略・・・

2.念のためリモート名とブランチを確認する。

git remote -v
# 多分originがhttps://~なんちゃらって出る。

git branch
# mainって出るはず

3. --allow-unrelated-histories を付けてpull

git push origin main --allow-unrelated-histories

masterの人はorigin masterで置き換えてください。
もしこのタイミングでコンフリクトが出たら修正しましょう。ここでは省きます。

4.最後にプッシュするだけ

git push origin main
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?