Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

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

andymgutman
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 28, 2020

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
Daniil Penkin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 28, 2020

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
AUG Leaders

Atlassian Community Events