Getting my code to a private repository



I have followed the follwoing instructions:

Step 1: Switch to your repository's directory

cd /path/to/your/repo
Step 2: Connect your existing repository to Bitbucket

git remote add origin push -u origin master


That did not work.


Then I followed theses:


git init

git remote add origin

git add --all

git push -u origin master


then I get the following error:


error: src refspec master does not match any.
error: failed to push some refs to ''

Why is it so 'complicated' ??

1 answer

0 vote

Hi Steen

For the above steps to work, you need to have your repository created locally and it must be a Git repository. You said the first set of steps did not work, did you get any error message? Can you paste it here?

For more info on how to initialize a Git repo you can follow our tutorial Setting up a repository or read the official Git documentation.





the problem is that the 'guide' on bitbucket is missing a step

before the 'push' a 'commit' is needed - that is not mentioned on the 'front' of a new repository

Hi Steen, the guide is assumming that you already have a repository (this is a code project that has already been initialized with Git or Mercurial). In your case it looks like you didn't have a repository, but un unversioned code project.

As this could be confusing for some users, I've submitted a feature request to make this message clearer and also to add a third option to that screen: 'I have an unversioned project'. You can find this feature request at You can vote for it to increase it's popularity, watch it to receive updates or add a comment.

In the meantime, you can find the steps at Add unversioned code to a repository.

Hope this helps!


Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jun 12, 2018 in Bitbucket

Do you use any Atlassian products for your personal projects?

After spinning my wheels trying to get organized enough to write a book for National Novel Writing Month (NaNoWriMo) I took my affinity for Atlassian products from my work life and decided to tr...

23,272 views 26 12
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you