Solucionado (ver solução)
Solucionado
(ver solução)
6
respostas

erro o comando push

olá o meu código e ele não está mandando as alterações para o github

rodolpho santos@RODOLPHO MINGW32 ~/local (master) $ git remote original osiris primeiro

rodolpho santos@RODOLPHO MINGW32 ~/local (master) $ git push primeiro HEAD:master error: src refspec HEAD does not match any. error: failed to push some refs to 'https://github.com/270210/exemple.git'

rodolpho santos@RODOLPHO MINGW32 ~/local (master) $ git push master primeiro error: src refspec primeiro does not match any. error: failed to push some refs to 'master'

rodolpho santos@RODOLPHO MINGW32 ~/local (master) $ git config --global user.name "guilherme"

rodolpho santos@RODOLPHO MINGW32 ~/local (master) $ git config --global user.email "270210.gui@gmail.com"

rodolpho santos@RODOLPHO MINGW32 ~/local (master) $ git push primeiro master error: src refspec master does not match any. error: failed to push some refs to 'https://github.com/270210/exemple.git'

EU JÁ TENTEI USAR O FLAG " -U" E O FAZENDO O " HEAD:" E EU ESTOU NA PASTA DO REPOSITÓRIO QUE É "LOCAL" E MESMO ASSIM NÃO FUNCIONA APRESENTA A MESMA MENSAGEM????

NESSA PARTE EU FIZ TUDO NOVAMENTE ELE ATÉ SOLICITOU O USER NAME MAIS MESMO ASSIM A MENSAGEM APARECE:

rodolpho santos@RODOLPHO MINGW32 ~/local (master) $ git push -u oficial master Logon failed, use ctrl+c to cancel basic credential prompt. Username for 'https://github.com/': 270210 To https://github.com/270210/exemple.git ! [rejected] master -> master (fetch first) error: failed to push some refs to 'https://github.com/270210/exemple.git' hint: Updates were rejected because the remote contains work that you do hint: not have locally. This is usually caused by another repository pushing hint: to the same ref. You may want to first integrate the remote changes hint: (e.g., 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.

rodolpho santos@RODOLPHO MINGW32 ~/local (master) $ git push -u oficial master To https://github.com/270210/exemple.git ! [rejected] master -> master (fetch first) error: failed to push some refs to 'https://github.com/270210/exemple.git' hint: Updates were rejected because the remote contains work that you do hint: not have locally. This is usually caused by another repository pushing hint: to the same ref. You may want to first integrate the remote changes hint: (e.g., 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.

POR FAVOR ALGUEM PODE ME AJUDAR??????

6 respostas

Acho que vc não adicionou corretamente o repositório remoto.. o comando correto é:

git remote add origin https://github.com/user/repo.git

Como vc pode ver aqui => git remote add origin https://github.com/user/repo.git

Você fez:

git remote original osiris primeiro

OLÁ ENTÃO EU TINHA FEITO E MESMO ASSIM APRESENTOU O MESMO ERRO:

rodolpho santos@RODOLPHO MINGW32 ~/local (master) $ git remote add primeiro https://github.com/270210/exemple.git

rodolpho santos@RODOLPHO MINGW32 ~/local (master) $ git push -u primeiro master error: src refspec master does not match any. error: failed to push some refs to 'https://github.com/270210/exemple.git'

E QUANDO EU VOU VER NOS MEUS ARQUIVOS REMOTOS ADICIONADO ELES ESTÃO LÁ

rodolpho santos@RODOLPHO MINGW32 ~/local (master) $ git remote original osiris primeiro

Oi Guilherme, você fez algum commit no seu repositório? Parece que isso está acontecendo pois não tem nenhum commit

abraços!

então fiz todo o procedimento novamente apaguei o .git e criei um novo e mesmo assim dá uma olha no código:

rodolpho santos@RODOLPHO MINGW32 ~/local (master) $ git init Initialized empty Git repository in C:/Users/rodolpho santos/local/.git/

rodolpho santos@RODOLPHO MINGW32 ~/local (master) $ git status On branch master

Initial commit

Untracked files: (use "git add ..." to include in what will be committed)

"Git e GitHub codigos e instala\303\247ao.txt"

nothing added to commit but untracked files present (use "git add" to track)

rodolpho santos@RODOLPHO MINGW32 ~/local (master) $ git add .

rodolpho santos@RODOLPHO MINGW32 ~/local (master) $ git status On branch master

Initial commit

Changes to be committed: (use "git rm --cached ..." to unstage)

new file: "Git e GitHub codigos e instala\303\247ao.txt"

rodolpho santos@RODOLPHO MINGW32 ~/local (master) $ git commit -m Git e Github codigos e inslaçao.txt error: pathspec 'e' did not match any file(s) known to git. error: pathspec 'Github' did not match any file(s) known to git. error: pathspec 'codigos' did not match any file(s) known to git. error: pathspec 'e' did not match any file(s) known to git. error: pathspec 'inslaçao.txt' did not match any file(s) known to git.

rodolpho santos@RODOLPHO MINGW32 ~/local (master) $ git commit -m "Git e Github codigos e instaçao.txt" [master (root-commit) cd23079] Git e Github codigos e instaçao.txt 1 file changed, 129 insertions(+) create mode 100644 "Git e GitHub codigos e instala\303\247ao.txt"

rodolpho santos@RODOLPHO MINGW32 ~/local (master) $ git diff --staged

rodolpho santos@RODOLPHO MINGW32 ~/local (master) $ git remote add origin https://github.com/270210/exemple.git

rodolpho santos@RODOLPHO MINGW32 ~/local (master) $ git push -u origin master To https://github.com/270210/exemple.git ! [rejected] master -> master (fetch first) error: failed to push some refs to 'https://github.com/270210/exemple.git' hint: Updates were rejected because the remote contains work that you do hint: not have locally. This is usually caused by another repository pushing hint: to the same ref. You may want to first integrate the remote changes hint: (e.g., 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.

Oi Guilherme, agora o erro foi diferente, o erro que deu agora está falando que você precisa primeiro dar um pull antes de dar um push.

Como você deu um git init novamente, mas já existem coisas no seu repositorio remoto, você precisa dar um pull pra eles sincronizarem, e aí sim dar um push

solução!

achei o erro era atraves do comando " git pull " e o reedme.md criado no repositorio do github e a chave publica para solucionar o problema muito obrigado desenvolvedores do alura pela ajuda

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software