1
4

More than 3 years have passed since last update.

githubのpushで、$ git push origin masterがエラーになる

Posted at

ターミナルで
$ git push origin master
と入力すると、

! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'https://github.com/[name]/[github-name].git'
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

エラーが出てしまいます。

同じエラーメッセージが出た方は、
$ git push -f origin master
と入力すると

Enumerating objects: 199, done.
Counting objects: 100% (199/199), done.
Delta compression using up to 8 threads
Compressing objects: 100% (186/186), done.
Writing objects: 100% (199/199), 164.33 KiB | 4.98 MiB/s, done.
Total 199 (delta 17), reused 0 (delta 0)
remote: Resolving deltas: 100% (17/17), done.
To https://github.com/[name]/[github-name].git
 + 9e623da...4e78ded master -> master (forced update)

成功します!

1
4
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
4