Caleb Bertrand
Caleb Bertrand

Reputation: 414

terminal remote repo has wrong url

I have not really used the terminal much, but I want to push my project to a remote repo on bitbucket. After I stage and commit everything, I put:

Tammys-MacBook-Pro:Pathogen calebbertrand$ git remote add origin https://[email protected]/CalebBertrand/pathogen.git
fatal: remote origin already exists.
Tammys-MacBook-Pro:Pathogen calebbertrand$ git push -u origin --all

Password for 'https://[email protected]': 
remote: Invalid username or password. If you log in via a third party service you must ensure you have an account password set in your account profile.
fatal: Authentication failed for 'https://[email protected]/Awesomeninjawarrior/pathogen.git/'

As you can see, the Terminal thinks I want to push to [email protected], but actually I want to push to [email protected]. AwesomeNinjawarrior was my old username, but then I changed it on the bitbucket website. How do I tell the terminal to push to the right url?

Upvotes: 0

Views: 332

Answers (2)

Dan Lowe
Dan Lowe

Reputation: 56687

When you attempted to add the remote, you got an error back, that the origin already existed. Therefore that command had a net effect of doing nothing.

$ git remote add origin https://[email protected]/CalebBertrand/pathogen.git
fatal: remote origin already exists.

Since the remote already exists, to set its URL you need to modify it instead.

$ git remote set-url origin https://[email protected]/CalebBertrand/pathogen.git

Upvotes: 0

Schwern
Schwern

Reputation: 165586

The git remote add didn't work and you got an error.

$ git remote add origin https://[email protected]/CalebBertrand/pathogen.git
fatal: remote origin already exists.

fatal: remote origin already exists. says you tried to add a new remote, but it already exists. You already have a remote named origin. "Fatal" means the command didn't work.

Instead you can change an existing remote with git remote set-url origin https://[email protected]/CalebBertrand/pathogen.git.

You can also list your remotes with git remote -v.

Read Working With Remotes in the Pro Git book.

Upvotes: 1

Related Questions