Git: git push
So I have problem listed in title.
I want to use just git push -u origin master
.
But if this command typed I'm getting:
error: src refspec master does not match any.
error: failed to push some refs to 'https://github.com/myprofile/my_project.git'
I did a search on this problem(git: error: src refspec master does not match any, src refspec master does not match any when pushing commits in git) - but solutions didn't help in my case.
Seems like I just forget to do some initial commit to original remote branch and instead created another branch which then was used.
This is output from git ls-remote
:
$ git ls-remote
From https://github.com/myprofile/my_project.git
152e795f054f6f756842bf61ee968ba3e5ee873d HEAD
7d505dbf09585ecfbb239c2148337043b899cc13 refs/heads/add-mysql-repo
152e795f054f6f756842bf61ee968ba3e5ee873d refs/heads/break-into-modules
e7905a3dacc9ea3e6c4c1f2dd9412f8deb692e30 refs/heads/master
This is github graph's network window:
So to sum up - what should I do to properly use git push -u origin master
instead git push -u origin origin:master
?
EDIT:
$ git branch -avv
add-mysql-repo 7d505db add mysql case to switch
break-into-modules 152e795 add gitignore
* origin e7905a3 [origin/master] add methods for entities validation
remotes/origin/master e7905a3 add methods for entities validation
$ git remote -v
origin https://github.com/myprofile/my_project.git (fetch)
origin https://github.com/myprofile/my_project.git (push)
Considering the output of git branch -avv
:
master
, origin
(a remote referencing the upstream repo ). That means you should:
rename the branch origin:
git branch -m origin master
push normally
git push -u origin master
上一篇: 如何在git中克隆单个分支?
下一篇: Git:git push