Ao executar git push -u origin main no terminal estou me deparando como erro abaixo:
error: src refspec main does not match any
error: failed to push some refs to 'github.com:edusousacti/New-Challenge.git'
Ao executar git push -u origin main no terminal estou me deparando como erro abaixo:
error: src refspec main does not match any
error: failed to push some refs to 'github.com:edusousacti/New-Challenge.git'
Ola!
Isso dá porque o Git não encontrou a branch main no seu repositório local.
Você ainda não fez nenhum commit
O Git só cria a branch de fato quando há pelo menos um commit.
Solução:
git add .
git commit -m "primeiro commit"
git branch -M main
git push -u origin main
O nome da branch local é diferente
Em algumas versões do Git a branch inicial é chamada de master.
Verifique qual branch você está usando:
git branch
Se aparecer * master
, então basta renomear para main:
git branch -M main
git push -u origin main
Ou, se preferir manter master
:
git push -u origin master
Primeiro confira se já existe um commit feito e qual é o nome da sua branch atual.