Troubleshooting github com git

Primeiramente apresentarei o escopo de cenário. Onde será no repositório remoto github, novo ou já existe. Q após processo de início básico, apresente erro.

Novo Repositório em linha de Comando

  • git init
  • git add README.md
  • git commit -m "first commit"
  • git remote add origin https://github.com/britodfbr/p335-intranet.git
  • git push -u origin master

Repositório existente em linha de Comando

  • git remote add origin https://github.com/britodfbr/p335-intranet.git
  • git push -u origin master

Execução com Erro

git push -u origin master

error: The requested URL returned error: 403 while accessing https://github.com/britodfbr/p335-intranet.git/info/refs

fatal: HTTP request failed

Configuração inicial

cat .git/config

[core]

repositoryformatversion = 0

filemode = true

bare = false

logallrefupdates = true

[remote "origin"]

url = https://github.com/britodfbr/p335-intranet.git

fetch = +refs/heads/*:refs/remotes/origin/*

Solução

git remote set-url origin https://britodfbr@github.com/britodfbr/p335-intranet.git

Configuração final

cat .git/config

[core]

repositoryformatversion = 0

filemode = true

bare = false

logallrefupdates = true

[remote "origin"]

url = https://britodfbr@github.com/britodfbr/p335-intranet.git

fetch = +refs/heads/*:refs/remotes/origin/*

Execução sem Erro

git push -u origin master

Password:

Counting objects: 113, done.

Delta compression using up to 8 threads.

Compressing objects: 100% (112/112), done.

Writing objects: 100% (113/113), 24.92 MiB | 3.42 MiB/s, done.

Total 113 (delta 0), reused 0 (delta 0)

To https://britodfbr@github.com/britodfbr/p335-intranet.git

* [new branch] master -> master

Branch master set up to track remote branch master from origin.

Comentários