7

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: my_project branches

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)
Community
  • 1
  • 1
marknorkin
  • 3,904
  • 10
  • 46
  • 82

1 Answers1

5

Considering the output of git branch -avv:

  • you don't have a local branch named master,
  • you have a branch with the same name as origin (a remote referencing the upstream repo).

That means you should:

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250