Git push command, error encountered -fatal: invalid refspec 'https://github.......git'

melony_r picture melony_r · Oct 26, 2019 · Viewed 18k times · Source

I'm in the master branch and have added the remote branch, after which I'm unable to push the data from local to remote.:

$ Git remote add master https://....git

$ Git push origin master https:// ...git
Fatal: invalid refspec 'https://...git'

Answer

VonC picture VonC · Oct 26, 2019

You should "git remote add" origin, not master:

git remote add origin https://...
git remote remove master
git push -u origin master