0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

最初にGithubに新規レポジトリを作った時に、merge: origin/master - not something we can merge が出た時の解決策[Git merge]

Posted at

状況

新しくGithubにGUIで新規レポジトリを作り、すでにローカルにあるフォルダをリモートに移したい。前回の記事を参考

前回は、git push でリモートにあるファイルやディレクトリがローカルにはないことが原因でエラーが起きたため、push前にmergeをする必要があった。

今回も同様にmergeをすると、

git fetch 
git merge --allow-unrelated-histories origin/master
merge: origin/master - not something we can merge

というエラーが出た。

https://qiita.com/somarihair/items/8580e9964099e6923bde 
などを見ると、ブランチ名がタイポしているとこういうエラーが出るらしいが、タイポはしていない。

結果

README.txtを用意せずに新規レポジトリを作ると、何もファイルがないリモートのレポジトリが生成されるので、空のレポジトリをマージしようとしてエラーが出ていた。

そのため、mergeは無視して、git push -u origin master をすれば良い。

git push -u origin master
Enumerating objects: 12, done.
Counting objects: 100% (12/12), done.
0
1
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
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?