Git: pushing a new empty branch for an empty project?

I have an empty project on the remote that I cloned. Now I want to start working on a branch, testdev and start working on it without creating any mastering code.

 $ git checkout -b testdev $ git status On branch testdev Initial commit nothing to commit (create/copy files and use "git add" to track) 

Now I'm trying to push this thread to a bitbucket

 $ git push origin testdev error: src refspec testdev does not match any. error: failed to push some refs to 'https:// username@bitbucket.org /myremoterepo.git' 

I tried git add . and git commit -m "msg" , but this is useless since I do not have files to track or commit. So how can I direct an empty branch to an empty project?

+7
git bitbucket
source share
1 answer

If the repo is still empty, you can try creating an empty commit to push something:

 git commit --allow-empty -m "initial commit" git push -u origin testdev 

See also " Why do I need to explicitly push a new branch? "

+21
source share

All Articles