1

I am trying to push code into Github using command,

git push -u origin master 

But it is asking for username and password and when I enter username and password it is giving error as "remote: Invalid username or password." enter image description here

My username is "saekhan". I tried this with saekhan, "saekhan", @saekhan and "@saekhan". Please tell me where am I doing wrong?

2

2 Answers 2

0

One possibility is that your password includes a special character.
Then you should need to percent encode it (see "Percent-encoding reserved characters")

Check also your git config credential.helper: with a recent Git, it should ask your credentials through a popup window to cache them in the Windows Credential Manager

git config credential.helper 

Make sure you are using the latest Git for Windows.

I see a https://github.com/saekhan/node-course-2-web-server, so make sure your remote url is set to that repo:

git remote add origin https://github.com/saekhan/node-course-2-web-server # or git remote set-url https://github.com/saekhan/node-course-2-web-server 
Sign up to request clarification or add additional context in comments.

4 Comments

Yes, first I run git remote add command then I am trying to run 'git push -u origin master'
@S.R.KHAN Does it ask you for your credentials?
Sometimes and sometimes it gives error directly without asking password.
@S.R.KHAN you need to enter your GitHub account and password
0

To be sure, you have read/write permissions to repository.

Check remote server:

git remote -v 

At Git source code folder (at same level at where you seen hidden folder named .git)

git config user.name "YourFullName" git config user.email "[email protected]" 

then retry.

3 Comments

user.name user.email have nothing to do with GitHub authentication.
I tried but still got the same result.
@S.R.KHAN yes, because they have nothing to do with your issue.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.