Last active
February 8, 2022 12:31
-
-
Save TomXV/0733f255bbded94e221dd2267eff603f to your computer and use it in GitHub Desktop.
Git BashやWSL上で、Pushができない場合
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
error: failed to push some refs to 'URL' | |
エラーが発生する大体の理由:ローカルリポジトリとリモートリポジトリのブランチ名が一致してません | |
ブランチ名を一致させれば直ります | |
git branch -m 変更前 変更後 | |
git branch -m master main | |
ただ、問題なのがGitHubのデフォルトブランチ名が「main」の場合 | |
そもそも、ローカルリポジトリのデフォルトブランチ名を変更するか | |
GitHubの設定から「master」にすれば手間を省けます。 | |
git config --global init.defaultBranch main | |
このコマンドを実行すれば、ローカルのデフォルトブランチ名が「main」に変更できます。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment