1

I couldn't find an answer to this and maybe I'm just blindly missing a step here, but whenever I try to push my code to github and use the git push -u origin master it prompts password for "--global@github.com":

I enter my password for my account and it says

Password for 'https://--global@github.com': 
remote: Invalid username or password.
fatal: Authentication failed for 
'https://github.com/richardquirarte/QRealty.git/'

I've already used git config --global user.email and verified it was my email there, but it keeps bringing that up.

Again, sorry if this is an easy fix, I just could not find an answer for this anywhere. Thanks.

CodeWizard
  • 128,036
  • 21
  • 144
  • 167

4 Answers4

3

You probably had some bad config.

Try resetting the remote URL and your user name first:

git config --global user.name "some user name"
git remote set-url origin https://github.com/richardquirarte/QRealty.git
iBug
  • 35,554
  • 7
  • 89
  • 134
  • With GitHub, you have to use the GitHub credentials. It has nothing to do with those settings, Those settings are only for committing code – CodeWizard Dec 09 '18 at 09:33
  • @CodeWizard But anyway, it seems like the problem is that the HTTP authentication username is set to `--global`, which could be some other issues. – iBug Dec 09 '18 at 09:35
1

That looks like a git config --global gone wrong.

Try git config -l | grep global and see if you have any configuration with "global" in it.

If not, check your git config credential.helper and see if you have to remove the user --global associated with the GitHub URL (see "problem while I was pushing my code to github.com").

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
0

This is a late answer but I had the same issue and figured it out. I had accidentally set my credential username as --global somehow, so when I was prompted to login, I was prompted to login to --global@github.com.

To fix this:

git config --global credential.username "your github username here"

To make sure the credential username is correct:

git config -l

Now push your code.

git push 
-1

You are using https which require a password for any interaction with the server.
It's not hard to solve it but instead I'm recommending you to switch to ssh and you will not have to use passwords anymore.

Read his doc on how to.
https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/

To make it short:

  • Generate ssh key Open git bash and type: ssh-keygen
  • Once the ket is created copy it (the path to the public will be printed in your terminal)
  • Add the key to your GitHub account
  • Update the repo URL to your new URL

    git remote set-url origin <ssh url>
    
CodeWizard
  • 128,036
  • 21
  • 144
  • 167
  • The answer have nothing with the question. The question is about bad remote URL in local `.git/config`. – phd Dec 09 '18 at 11:36