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?

More than 3 years have passed since last update.

Git pushできない エラー発生対応

Posted at

#Git pushできない エラー発生対応
push時にエラーが発生しその時の対応を記録。

ec2-user:~/environment/〇〇 (main) $ git push origin main
~~~~~~~省略~~~~~~~~~~~~~~~~~~~~~~~~~~~

 ! [rejected]        main -> main (fetch first)
error: failed to push some refs to 'git@github.com:〇〇/〇〇.git'

~~~~~~~省略~~~~~~~~~~~~~~~~~~~~~~~~~~~

#対処法
リモートリポジトリを再設定する必要がある。GitHubのリポジトリの、「Initialize this repository with a README」が働いているため。

①リモート URL を削除するには git remote rm コマンドを打ち込む

$ git remote rm origin

②GitHubのリポジトリを、「Initialize this repository with a README」のチェックを入れずに作り直しましょう。

③リモートリポジトリを再設定

$ git remote add origin SSHを入力

④push使用

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?