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 1 year has passed since last update.

【メモ】GitHubエラー:プッシュがうまくいかない場合の対処法

Posted at

エラー内容

git:err
>git push main master
error: src refspec master does not match any
error: failed to push some refs to 'https://github.com/koinunopochi/ChatEasyAPI.git'

エラー発生状況

vscodeでGitHubに新しく作成したリモートレポジトリにフォルダプッシュしようとしたところ、このエラーが発生した。
2023-05-12_23h10_19.pngからプッシュ先を「main」に変更した気になったまま プッシュ したところ発生

エラー原因

エラーメッセージから、「master」ブランチが存在しないため発生とある通り、指定したはずの「main」ではなく「master」にプッシュしようとして失敗している。

解決法

1

git branch -m master main

を用いて、ローカルの設定を「master」から「main」に変更する

リモートで、mainを作成してしまう

まとめ

他にも

git push origin main

などがあるようだが、ひとまず解決法1,2で解決できそうなので、今後慣れてきたら他の方法も探していこうと思う。

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?