error: src refspec master does not match any.
Lovely! When this git error came up, I knew exactly what it meant. I mean
src refspec is perfectly clear! And everyone knows what
any git is talking about. /rant /sarcasm
Seriously, though, did Yoda write this? I was going about my merry way, trying to push some existing code (not currently a git repo) to Bitbucket and bam! I run into this goodie.
In my code directory, I issue
git init to initialize the git repository, then
git remote add origin https://email@example.com/travisred/dev.git to add the origin as my Bitbucket repo, then
git push -u origin master to push my code up.
“Wait you will, master does not match any,” says Yoda. Turns out this gem of an error is trying to tell me that nothing has been added/committed to the local repo. So to fix this I issued
git commit -am "imakillagit" then the previous commands,
git remote add origin https://firstname.lastname@example.org/travisred/dev.git and
git push -u origin master.
So, moral of the story, kids: don’t go pushin’ “empty” repos.