2023. 7. 25. 00:18ㆍTrouble shooting
git을 새로 생성하고
remote add 를 통해 생성한뒤
pull origin main 뒤
git push 시 발생
$ 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'.
이럴때는 원격저장소에 오류가 있는지 확인한다.
git remote -v
fetch, push 둘다 정상적으로 있다.
다시 git push
이 오류는 일반적으로 로컬 저장소의 master 브랜치가 존재하지 않거나, 아직 초기 커밋이 생성되지 않았을 때 발생
그냥
git push origin --all
로 모든 저장소를 푸시해준다.
(첫 push라 사용한 것이지 이미 좀 가지가 있는 작업중인 git 에서는 추천하지 않는다.)
먼저 로컬 저장소에서 현재 브랜치를 확인
$ git branch
만약 master 브랜치가 없다면, 새로운 브랜치를 만든다.
$ git checkout -b master
이제 초기 커밋을 만들어야 해요. 만약 아직 커밋된 파일이 없다면 아래 명령어로 커밋을 만들 수 있어요:ㅇ
$ git add .
$ git commit -m "Initial commit"
이제 원격 저장소로 master 브랜치를 다시 푸시
$ git push origin master
'Trouble shooting' 카테고리의 다른 글
ubuntu) 노트북 외장그래픽카드 인식 불가 (0) | 2023.08.17 |
---|---|
xcrun: error: invalid active developer path 에러 (0) | 2023.08.09 |
[tensorflow] RuntimeError: module compiled against API version 0xe but this version of numpy is 0xd (0) | 2023.06.27 |
[pandas] ValueError: Bin labels must be one fewer than the number of bin edges (0) | 2023.06.26 |
git) detected dubious ownership in repository (0) | 2023.05.22 |