I've been refreshing my gleb.reys.net website recently and experienced a weird error: pushing latest changes to GitHub resulted in my username and password prompted. Figured I should write down what the issue was and how easy it was to fix it.
git Repo Asks for Username/Password
greys@mcfly:~/proj/gleb.reys.net $ git push
Username for 'https://github.com': greys
Password for 'https://[email protected]':
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/greys/greys.github.io/'
greys@mcfly:~/proj/gleb.reys.net $ git remote
origin
greys@mcfly:~/proj/gleb.reys.net $ git remote show
origin
greys@mcfly:~/proj/gleb.reys.net $ git remote -v
origin https://github.com/greys/greys.github.io (fetch)
origin https://github.com/greys/greys.github.io (push)
At first I couldn't see it
Update The Origin in git Repository
greys@mcfly:~/proj/gleb.reys.net $ git remote rm origin
greys@mcfly:~/proj/gleb.reys.net $ git remote -v
greys@mcfly:~/proj/gleb.reys.net $ git remote add origin [email protected]:greys/greys.github.io.git
greys@mcfly:~/proj/gleb.reys.net $ git remote -v
origin [email protected]:greys/greys.github.io.git (fetch)
origin [email protected]:greys/greys.github.io.git (push)
Push (with set-upstream)
greys@mcfly:~/proj/gleb.reys.net $ git push
fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream origin master
greys@mcfly:~/proj/gleb.reys.net $ git push –set-upstream origin master
Enumerating objects: 7, done.
Counting objects: 100% (7/7), done.
Delta compression using up to 16 threads
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 568 bytes | 568.00 KiB/s, done.
Total 4 (delta 3), reused 0 (delta 0)
remote: Resolving deltas: 100% (3/3), completed with 3 local objects.
To github.com:greys/greys.github.io.git
018a8c0..e4f79d4 master -> master
Branch 'master' set up to track remote branch 'master' from 'origin'.
That's it! I'm using Netlify for automatic build and hosting of my Jekyll website, so a minute or two after the git push shown above the website got refreshed to the latest version. Nice!
See Also
- gleb.reys.net – my technical website and latest CV
- GlebReys.com – random notes on gadgets and technology
- Project: Static websites with Jekyll
- Unix Tutorial
- Free private repos on GitHub
Leave a Reply