$ git push
git push를 할 때, 아래와 같은 에러가 나는 경우가 있음.
이 에러는 원격 저장소에 기본 branch 설정을 안 해줬기 때문임.
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'.
$ git push --set-upstream origin main
Everything up-to-date
branch 'main' set up to track 'origin/main'.
다시 push 하면 완료
$ git push
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 16 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 280 bytes | 280.00 KiB/s, done.
Total 3 (delta 2), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (2/2), completed with 2 local objects.
To https://github.com/sodayeong/HYTREM.git
b44c107..131c239 main -> main
remote -v 명령어로 원격 저장소 이름을 찾은 뒤 (아래에선 origin)
$ git remote -v
origin https://github.com/sodayeong/HYTREM.git (fetch)
origin https://github.com/sodayeong/HYTREM.git (push)
원격 저장소를 명시해주고 push 하면 완료
git push origin main
간단하게 git push로만 하고 싶다면 방법 1로 하면 되겠다.