windows - Src refspec master does not match any error: failed to push some refs -


i have vs 2015 project on local disk, , wanted use code version control system in order work else.

he told me use bitbucket.

i've set new repository on bitbucket, , wanted put project it.

i've therefore download "git on windows". during installation, checked "use windows command line". started cmd, , ran following commands:

d:\dev\projects\myproject> git init git remote add origin https://myname@bitbucket.org/myreponame/osc.git git push -u origin master 

the last command returned error

"error: src refspec master not match any. error: failed push refs "https://myname@bitbucket.org/myreponame/osc.git"" 

when type "git branch", nothing returned.

what missing?

git init created empty repository. repository has 0 (count them!) commits in it.

git remote add origin <url> added git calls remote—a short name git repository—to existing, empty repository. existing repository continues have 0 commits in it.

git push <remote> <branch> tells git call git. git did so. tells git send, other git, commits have don't, git can find on branch (master, in case).

you still have 0 commits. how many commits have, don't?

now, there's interesting (related) side note: in git, branch cannot exist until has @ least 1 commit on it. while you're on master branch, master doesn't exist. explains precise form of error message.

the solution still same, though: must add commit(s) repository, on master branch. first 1 create cause branch exist, , once have commits don't, able send commits have, don't, them.

(this not mean accept commits, have send. let's not borrow trouble don't see yet: first, should create commits. :-) is, unless other git—the 1 on bitbucket—already has commits. in case, should obtain theirs. i'm going assume don't have either.)


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -