'Git push command, error encountered -fatal: invalid refspec 'https://github.......git'
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'
Solution 1:[1]
You should "git remote add" origin, not master:
git remote add origin https://...
git remote remove master
git push -u origin master
Solution 2:[2]
My problem was solved by changing the authentication method from HTTPS to SSH.
Guide for Github SSH keys: https://help.github.com/en/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent
Create a new SSH key in github (https://github.com/settings/keys)
Solution 3:[3]
I had similar problem with gitlab and what helped me in this case, was adding additional option --push-option=ci-skip and putting at the end HEAD:<branchname> like below
git checkout -b ${newbranch}
#..<do your stuff>..
#..<add and commit>...
git push --push-option=ci-skip http://${SERVER_HOST}/${PROJECT_PATH}.git/ HEAD:${newbranch}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | VonC |
| Solution 2 | jeppoo1 |
| Solution 3 | matson kepson |
