fatal: No such remote 'origin' (after git remote set-url origin https://...)

My code is already tracked by Git

If your code is already tracked by Git then add this repository as a new repository that you can push to.

I cd to /path/to/my/already_tracked/.git

git remote set-url origin https://user:server:port/scm/ABC/my_stash_repo.git

leads to:

fatal: No such remote 'origin'

also a "git remote -v " does not show the above stash-repo.

what is wrong in my thinking?


 

2 answers

1 accepted

25 votes

The above will only work if you've either cloned the repository or manually added a remote called origin.

If "git remote -v" doesn't show you any remotes you can simply add a remote using:

git remote add origin https://username@stash/scm/PROJECT/repo.git

The name of the remote doesn't have to be "origin" and can be any name that makes it easier for you to identify that particular remote (e.g. "stash").

HTH,

Stefan

It would be nice if the Stash instructions on the new empty repo page mentioned this.

Yes, I also noticed that the remote must be added, before you can specify an URL with set-url.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Jodi LeBlanc
Posted Thursday in Off-topic

Friday Fun: How do you recharge your batteries after a busy week?

Happy Friday – Fun Day! I don’t know about you, but I have been giving everything I’ve got this week (and most weeks) and come Friday I look for unique ways to recharge my batteries - rest, relax, a...

567 views 26 4
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