πŸ‘©‍πŸ’»/Git

[error] git push ν•  λ•Œ λœ¨λŠ” μ—λŸ¬ : The current branch main has no upstream branch/src refspec main does not match any

ν•œλ‚˜ 2020. 12. 17. 15:13

 

κΈ°μ‘΄ git 이λ ₯을 μ‚­μ œν•˜λ €κ³  git을 μ΄ˆκΈ°ν™”(initialize)ν•œ 뒀에 λ°œμƒν•œ μ—λŸ¬.

git remote -v 둜 ν˜„μž¬ 원격 μ €μž₯μ†Œ μƒνƒœλ₯Ό ν™•μΈν•˜κ³ , 반영이 잘 된 것을 ν™•μΈν•˜κ³ , μ•„λž˜ λͺ…λ Ήμ–΄λ₯Ό μ‹€ν–‰ν–ˆλ‹€.

 

git push -u 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
error: src refspec main does not match any
error: failed to push some refs to 'https://github.com/[원격 μ €μž₯μ†Œ μ£Όμ†Œ]'

브랜치 λ¬Έμ œμΈκ°€ ν–ˆλŠ”λ° 그건 μ•„λ‹ˆμ—ˆκ³ , git init 이후 git addλŠ” ν–ˆλŠ”λ°, git commit ν•΄μ„œ μŠ€ν…Œμ΄μ§€μ— μ˜¬λ¦¬μ§€ μ•Šμ•„μ„œμ˜€μŒ. κ°„λ‹¨ν•˜κ²Œ 해결됐닀.