2
respostas

error: remote origin already exists.

Olá! Tento seguir o passo a passo mas não consigo. Já olhei outras soluções no fórum mas continuo com o seguinte problema:

error: remote origin already exists.

Segue meu código:

PS C:\Users\dell\Desktop\alura-space> & c:/Users/dell/Desktop/alura-space/venv/Scripts/Activate.ps1
(venv) PS C:\Users\dell\Desktop\alura-space> & c:/Users/dell/Desktop/alura-space/venv/Scripts/python.exe c:/Users/dell/Desktop/alura-space/setup/settings.py
  File "c:\Users\dell\Desktop\alura-space\setup\settings.py", line 14
    from dotenv load_dotenv
                ^^^^^^^^^^^
SyntaxError: invalid syntax
(venv) PS C:\Users\dell\Desktop\alura-space> git pull
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.

    git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

    git branch --set-upstream-to=origin/<branch> master

(venv) PS C:\Users\dell\Desktop\alura-space> git pull origin main
fatal: couldn't find remote ref main
(venv) PS C:\Users\dell\Desktop\alura-space> git push origin main
error: src refspec main does not match any
error: failed to push some refs to 'https://github.com/GabrielSPinto/alura_space.git'
(venv) PS C:\Users\dell\Desktop\alura-space> git push origin main
error: src refspec main does not match any
error: failed to push some refs to 'https://github.com/GabrielSPinto/alura_space.git'
(venv) PS C:\Users\dell\Desktop\alura-space> git commit -m "initial commit" git push origin master
>>
>>
error: pathspec 'git' did not match any file(s) known to git
error: pathspec 'push' did not match any file(s) known to git
error: pathspec 'origin' did not match any file(s) known to git
error: pathspec 'master' did not match any file(s) known to git
(venv) PS C:\Users\dell\Desktop\alura-space> git add .
>> git commit -m "Commit inicial"
Author identity unknown

*** Please tell me who you are.

Run
(venv) PS C:\Users\dell\Desktop\alura-space> git init
Reinitialized existing Git repository in C:/Users/dell/Desktop/alura-space/.git/
(venv) PS C:\Users\dell\Desktop\alura-space> git add.
git: 'add.' is not a git command. See 'git --help'.

The most similar command is
        add
(venv) PS C:\Users\dell\Desktop\alura-space> git commit -m "projeto alura space"
Author identity unknown

*** Please tell me who you are.

Run

  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got 'dell@DESKTOP-ONPPQCT.(none)')
(venv) PS C:\Users\dell\Desktop\alura-space> git remote add origin https://github.com/GabrielSPinto/alura_space.git
error: remote origin already exists.
(venv) PS C:\Users\dell\Desktop\alura-space> git push origin master
error: src refspec master does not match any
error: failed to push some refs to 'https://github.com/GabrielSPinto/alura_space.git'
(venv) PS C:\Users\dell\Desktop\alura-space> git push origin main
error: src refspec main does not match any
error: failed to push some refs to 'https://github.com/GabrielSPinto/alura_space.git'
(venv) PS C:\Users\dell\Desktop\alura-space> git remote add origin https://github.com/GabrielSPinto/alura_space.git
error: remote origin already exists.
(venv) PS C:\Users\dell\Desktop\alura-space> git add .
>> git commit -m "Commit inicial"
Author identity unknown

*** Please tell me who you are.

Run

  git config --global user.email "you@example.com"
(venv) PS C:\Users\dell\Desktop\alura-space> git init
Reinitialized existing Git repository in C:/Users/dell/Desktop/alura-space/.git/
(venv) PS C:\Users\dell\Desktop\alura-space> git add .
(venv) PS C:\Users\dell\Desktop\alura-space> git commit -m "projeto alura space"
Author identity unknown

*** Please tell me who you are.

Run

  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got 'dell@DESKTOP-ONPPQCT.(none)')
(venv) PS C:\Users\dell\Desktop\alura-space> git remote add origin https://github.com/GabrielSPinto/alura_space.git
error: remote origin already exists.

Insira aqui a descrição dessa imagem para ajudar na acessibilidade

2 respostas

Olá, Ana! Tudo bem?

O erro "error: remote origin already exists" indica que você já adicionou o repositório remoto como "origin" anteriormente.

Para solucionar esse problema, você deve remover o repositório remoto atual e adicionar novamente. Você pode fazer isso executando os seguintes comandos no terminal:

git remote remove origin
git remote add origin https://github.com/GabrielSPinto/alura_space.git

Vendo os erros retornados, percebi que você não definiu algumas informações essenciais para o seu usuário, para fazer isso, você executar os seguintes comandos:

git config --global user.email "you@example.com"
git config --global user.name "Your Name"

Nos campos que estão entre aspas duplas você deve apagar tudo, até mesmo as aspas duplas, e adicionar o e-mail do seu GitHub e o seu usuário.

Após isso, você pode tentar enviar o código usando novamente o comando git push origin main ou git push origin master, dependendo da branch que você está trabalhando.

Lembrando que é importante verificar se você está na branch correta antes de fazer o push. Você pode usar o comando git branch para verificar as branches disponíveis e o comando git checkout <nome-da-branch> para mudar para a branch desejada.

Espero que isso resolva o seu problema! Se tiver mais alguma dúvida, é só me dizer. Estou aqui para ajudar!

Grande abraço e bons estudos!

Caso este post tenha lhe ajudado, por favor, marcar como solucionado ✓.

Olá pessoal, Armando muito obrigado por aqui foi solucionado.