I was facing the same problem, here is what I did that worked for me.
- Use ssh instead of http. Remove origin if its http.
git remote rm origin
2. Add ssh url
git remote add origin [email protected]:<username>/<repo>.git
3.Generate ssh key inside .ssh/ folder. It will ask for passphrase and path where you can just press enter and proceed.
4. Now, copy the key. You can view your key using. If you hadn't specified a different path then this is the default one for you to use.
5. Add this key to your Github account. Next, do
ssh -T [email protected]
You will get a welcome prompt in your console.
cd into to your project folder. git push -u origin master now works!