git push本地master分支到遠程github的main分支
最簡單的方式是保持本地和遠程的分支同名,當然這樣也不算解決問題
拉取遠程的main分支到本地master分支
首先要從遠程的main分支中拉取一次
git pull origin main
這里如果本地的分支不為空的話,需要進行merge
push 到遠程
直接
git push origin main
會報錯
fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream origin master
嘗試按照提示的輸入也還是沒有作用
最后指定本地和遠程的分支解決問題
git push origin master:main
