Error in command "Git push: fatal: could not read Username"

0

After committing a file and giving the command "Git push origin master", an error occurs giving the message:

fatal: could not read Username for 'https://github.com': No such file or directory

How to solve?

    
asked by anonymous 30.01.2014 / 01:20

4 answers

2

Third, Your repository has been configured incorrectly. To confirm, type:

git remote show origin -n

Verify that the Fetch URL and Push URL are pointing to your repository, if they are not:

Remove the current

git remote rm origin

And add again

For SSH

git remote add origin '[email protected]:seu_usuario/seu_repositorio.git'

or if you are using HTTPS

git remote add origin 'https://[email protected]/usuario_dono_repositorio/nomerepositorio.git'
    
30.01.2014 / 01:35
2

I follow the following commands when committing:

git status
git add . ou git add -A
git commit -m "mensagem"
git pull origin master /*deve-se criar o remote 'origin' antes*/
git push origin
    
30.01.2014 / 01:35
1

There is an answer to this question in the English stackoverflow.

link

In response and suggested execution of commands:

git remote rm origin
git remote add origin '[email protected]:username/repo.git'

Anyway, it is also suggested to remove "https", and use only the "github.com" domain.

    
30.01.2014 / 01:28
0

Within your project there should be a folder called ".git". Enter this folder, and make sure the config file has the correct address.

[remote "origin"]
url = https://[email protected]:usuario/projeto.git
fetch = +refs/heads/*:refs/remotes/origin/***texto em negrito**

If it is not correct, change the url to the file. If that does not work, give it a git status and paste it here so we can look better.

    
30.01.2014 / 04:15