Please help! fatal: remote origin already exists

I am trying to finish the Mixed Messages project, and the most frustrating part so far is GitHub. I’ve tried all of this and gotten various error messages and then deleted the GitHub repository only to start again several times, so…yeah, not great.

I went back to the git lessons and followed them. Right now I’m at the very beginning and there’s already a problem.

MixedMessages % git init                               
Reinitialized existing Git repository in /Users/[buncha identifying information]/MixedMessages/.git/
MixedMessages % git add main.js
% git commit -m "main.js"       
On branch main
Your branch is up to date with 'origin/main'.

Untracked files:
	.DS_Store
	.idea/

nothing added to commit but untracked files present

ok… and now when I try to push this existing local repository to one I’ve just created on GitHub, I get this error message:

MixedMessages % git remote add origin https://github.com/inprogresspleasehold/MixedMessages.git
fatal: remote origin already exists.

And I keep circling around to this. I’m not sure what I’m doing wrong, and nothing in the course materials is any help. I’m looking at other sources, but I’m also getting really frustrated. Can someone clarify what is going on, and where I went wrong?

Thanks in advance for any help you can give me

You already have a remote named origin. You can see it and the related pull/push address with git remote -v. If it’s set correctly then no worries but you can remove it with git remove origin or alter the url with git remote set-url git@github...a/b/c etc..

Try git remote -h (this works for most git commands) for a short guide to the cli options which might help you work your way around this command and others. The full man page would have more details if necessary.

2 Likes

Hi! So I tried git remote -v, and, well, this happened:

MixedMessages % git remote -v
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

I’m going to run through some more stuff and google that, but I’m very confused.

Is this OSX? It looks like one of the funny ones where xcode / commad line tools aren’t installed or have some mild issues. I don’t know the exact fix but you could try updating the “xcode command line tools”. That error and the command line tools are probably what you want to be searching for either way.

Yup, OSX. Thanks for your help!

I found another resource for this error message here:

I have to agree with the author – I think this could have been avoided if the codeacademy materials actually explained what was going on, rather than have us copy and paste from GitHub pages.

Tbh I’m still not comfortable with git, but hopefully future modules actually explain what we need to know.