Home » Git » How to resolve fatal: No such remote ‘origin’

How to resolve fatal: No such remote ‘origin’

By Emily

If you see the “fatal: No such remote ‘origin’” message then you are probably trying to use a remote repo for the first time, especially if you use BitBucket. They handily provide you with a starter page when you view a repo for the first time when it has no code in it. However if you follow their instructions for how to push code into the repo when your local folder is already initialized as a a git repo, then you may see this message. The instructions tell you to use this command :

git remote set-url origin http://your-user-name@stash.ds.local/scm/repo-name/webapp.git

But you’ll probably get this error message:

fatal: No such remote 'origin'

What does the message mean?

That means you can’t push your code. Your git remote has a name, and the default name is origin. This message is telling us that there is NOT a remote in the repo specified called origin.

How to fix the “fatal: no such remote” problem

First of all use this command to check what your remote is currently set up as:

git remote -v

If you get no response returned from that command, then there is no remote specified at all. So you need to add the origin like this:

git remote add origin http://your-user-name@stash.ds.local/scm/repo-name/webapp

Now if you try the git remote -v command you should see that your remote repo has a remote set up and that it’s called origin.

Now you can push your code 🙂

This topic is discussed in this forum thread, in case my post hasn’t solved your problem then take a look there.