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

[Dúvida] estou com dificuldade de fazer o git push origin main

Já configurei a ssh key porém sigo tendo esse erro quando tento fazer o código de push:

Nilton@Nilton-PC MINGW64 ~/desktop/Night-Mode (main)
$ git status
On branch main
Your branch is ahead of 'origin/main' by 2 commits.
  (use "git push" to publish your local commits)

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        bash.exe.stackdump
        sh.exe.stackdump

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

Nilton@Nilton-PC MINGW64 ~/desktop/Night-Mode (main)
$ git push origin main
fatal: Ocorreu um erro ao enviar a solicitação.
fatal: A solicitação foi anulada: Não foi possível criar um canal seguro para SSL
remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-giositories#cloning-with-https-urls for information on currently recommended modes
fatal: Authentication failed for 'https://github.com/vitorr2101/Night-Mode-Dc-Her
5 respostas

Olá Vitor tudo bom? sou estudante e vou tentar ajudar, pelo que vi no seu report tem itens que foram mexidos, chamados Untracked files, ele sugere alguns Untracked files: (use "git add ..." to include in what will be committed) bash.exe.stackdump sh.exe.stackdump

Eu tentaria usar o "git add . "  , com o ponto incluindo todos os arquivos, em seguida vai precisar dar um commit com uma mensagem e só depois o push 
Espero que isso ajude

fiz o que disse e parece que deu certo... porém o meu sketch.js ainda esta dando como erro (quando executo o pull, como pede o terminal). não sei o que fazer nele para não dar esse conflito.

$ git add .
warning: in the working copy of 'bash.exe.stackdump', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'sh.exe.stackdump', LF will be replaced by CRLF the next time Git touches it

Nilton@Nilton-PC MINGW64 ~/desktop/Night-Mode (main)
$ git commit . -m"teste apos add os arquivos"
warning: in the working copy of 'bash.exe.stackdump', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'sh.exe.stackdump', LF will be replaced by CRLF the next time Git touches it
[main 865d516] teste apos add os arquivos
 7 files changed, 142 insertions(+)
 create mode 100644 bash.exe.stackdump
 create mode 100644 sh.exe.stackdump
 create mode 100644 sketch_BACKUP_1570.js
 create mode 100644 sketch_BASE_1570.js
 create mode 100644 sketch_LOCAL_1570.js
 create mode 100644 sketch_REMOTE_1570.js

Nilton@Nilton-PC MINGW64 ~/desktop/Night-Mode (main)
$ git status
On branch main
Your branch and 'origin/main' have diverged,
and have 6 and 6 different commits each, respectively.
  (use "git pull" to merge the remote branch into yours)

nothing to commit, working tree clean

Nilton@Nilton-PC MINGW64 ~/desktop/Night-Mode (main)
$ git pull origin main
From https://github.com/vitorr2101/Night-Mode-Dc-Heroes
 * branch            main       -> FETCH_HEAD
Auto-merging sketch.js
CONFLICT (content): Merge conflict in sketch.js
Automatic merge failed; fix conflicts and then commit the result.

Nilton@Nilton-PC MINGW64 ~/desktop/Night-Mode (main|MERGING)
$ git reset --mixed
Unstaged changes after reset:
M       sketch.js

Nilton@Nilton-PC MINGW64 ~/desktop/Night-Mode (main)
$ git status
On branch main
Your branch and 'origin/main' have diverged,
and have 6 and 6 different commits each, respectively.
  (use "git pull" to merge the remote branch into yours)

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   sketch.js

no changes added to commit (use "git add" and/or "git commit -a")

Nilton@Nilton-PC MINGW64 ~/desktop/Night-Mode (main)
$ git add sketch.js

Nilton@Nilton-PC MINGW64 ~/desktop/Night-Mode (main)
$ git commit . -m"teste apos add o sketch.js"
[main 3542bec] teste apos add o sketch.js
 1 file changed, 3 insertions(+)

Nilton@Nilton-PC MINGW64 ~/desktop/Night-Mode (main)
$ git push origin main
fatal: Ocorreu um erro ao enviar a solicitação.
fatal: A solicitação foi anulada: Não foi possível criar um canal seguro para SSL/TLS.
remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/vitorr2101/Night-Mode-Dc-Heroes.git/'
solução!

Hum, aí parece outro problema, seus comandos estão corretos, mas me parece ser que o git não encontra a chave ssh para se conectar, não sei se gerou, procurei no curso qual o momento disso, mas não encontrei, precisa gerar a chave e incluir no seu perfil do github , segue o passo a passo https://docs.github.com/pt/enterprise-server@3.6/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent

esta forma de usar chaves para SSH é usado em quase tudo hoje em dia que utiliza linha de comando(terminal)

espero ter ajudado

Obrigado pela ajuda, esse link me deu a dica sobre o github desktop, e após fazer o login por ele e fazer os comandos do terminal, consegui fazer o push e atualizar o meu projeto remoto! Novamente obrigado pelo toque.

bacana que conseguiu, aprender usar o git pelo terminal é essencial continue treinando nele. Sim o github desktop é fantástico, facilita muito, e também tem a integração do git pelo Vscode ou qualquer outra IDE, cuidado só pra não acostumar com as facilidades e esquecer os comandos, Parabéns e obrigado pelo feedback!

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