【Git】git push時のno upstream branchを解決する

はじめに

git pushをしたら、以下のエラーが発生した。

hiroki@shibatahiroshitakanoMacBook-Air ki-hi-ro.com % git push
fatal: The current branch main has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin main

To have this happen automatically for branches without a tracking
upstream, see 'push.autoSetupRemote' in 'git help config'.

エラーの意味

現在のmainブランチは、上流ブランチがない。

提案された「git push –set-upstream origin main」を行ってみる

少し(5秒ほど)時間がかかったが、平常通りプッシュすることができた。

hiroki@shibatahiroshitakanoMacBook-Air ki-hi-ro.com % git push --set-upstream origin main 
Enumerating objects: 7, done.
Counting objects: 100% (7/7), done.
Delta compression using up to 10 threads
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 409 bytes | 409.00 KiB/s, done.
Total 4 (delta 3), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (3/3), completed with 3 local objects.
To https://github.com/ki-hi-ro/ki-hi-ro.com-2022.git
   5293200..be04d2b  main -> main

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です