Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Error - Create a Repository - add unversioned code to a repository

I was following the instructions at https://confluence.atlassian.com/bitbucket/add-unversioned-code-to-a-repository-877177133.html

 

I included the last 2 steps from the link above  ...

% git remote add origin https://x@bitbucket.org/...

fatal: remote origin already exists

% git push -u origin -all
...

![rejected]   master->master (fetch first)
error: failed to push some refs to 'https..'
hint: ...

Obviously I did something wrong. Any guidance appreciated.

Thanks

 

 

 

1 answer

1 accepted

0 votes
Answer accepted

Hello @andymgutman,

The error you see means that there's already a remote with name origin registered in your repository. Git repository can have arbitrary number of named remotes. To list them along with their URLs you can run this command:

$ git remote -v
origin git@bitbucket.org:dpenkin/test-repo.git (fetch)
origin git@bitbucket.org:dpenkin/test-repo.git (push)

In this example I have just one remote called origin with two URLs: one for fetching, one for pushing (they can be configured independently, but in most cases they are same).

So I'd recommend you to do the following:

  • check your current remotes configuration by running git remote -v
  • if the remote URL there is not what you want, you can change it with:
git remote set-url origin <url>
  • or delete it with
git remote remove origin
  • or you can register new remote with a different name and then use it in your subsequent commands:
git remote add <remote-name> <url>
git push <remote-name> <branch-name>

Here's the relevant Git documentation page.

Hope this helps. Let me know if you have any questions.

Cheers,
Daniil

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

Powering DevOps with Bitbucket Server & Data Center

Hi everyone, The Cloud team recently announced 12 new DevOps features that help developers ship better code, faster   ! While we’re all excited about the new improvements to Bitbucket ...

1,826 views 0 7
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you