jac300
jac300

Reputation: 5222

Unable to Change my Remote Repo

I am a bit new to git, and as a result I have gotten myself into a git mess. I have an Xcode 4.5 project. In the command line I have been managing its local git repo as well as a remote repo on github that the local one is linked to. All was well until I decided to delete the remote repo on the GitHub website (called PictureFly) and create a new remote repo on the GitHub website (called PhotoFly). I would like my local repo to be unlinked to the old remote repo (PictureFly) and linked to the new remote repo (PhotoFly). Seems simple, but no matter what command I enter, I get one fatal warning or another. Here is a typical example of what I have been doing:

My attempts to remove the old remote origin:

//first attempt
git push origin :https://github.com/jac300/PictureFly.git
//first error
fatal: remote part of refspec is not a valid name in      
:https://github.com/jac300/PictureFly.git

//second attempt
git push origin :PictureFly.git
//second set of errors
fatal: 'git' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.

//third attempt    
git push origin --delete PictureFly
//third set of errors
fatal: 'git' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.

//fourth attempt
git push origin --delete https://github.com/jac300/PictureFly.git
//fourth set of errors
fatal: 'git' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.

Then I thought maybe I can just add the new remote repo:

git remote add origin https://github.com/jac300/PhotoFly.git
fatal: remote origin already exists.  //how does it already exist?

So since it "already exists" I tried to push to that repo:

git push -u origin master
fatal: 'git' does not appear to be a git repository
fatal: Could not read from remote repository.

I have no idea what is happening or how to fix it. Any help is appreciated.

Upvotes: 0

Views: 627

Answers (1)

PinnyM
PinnyM

Reputation: 35531

You can easily remove the repo on GitHub and create a new empty one from the website. So now you're stuck with your remotes pointing to the wrong url. To fix:

git remote set-url origin https://new.url.here

Upvotes: 2

Related Questions