Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git - Fatal: Will not delete all non-push URLs

Tags:

git

When trying to remove the default url in my repo, I issued the command:

git remote set-url --delete origin https://github.com/dpressey/barberapp.git

I received the error as shown above in the title. How do I delete this "https" url and then add an "ssh" url, so that i can push to it?

like image 968
Denzel Pressey Avatar asked Aug 23 '14 16:08

Denzel Pressey


People also ask

How do you fix fatal could not read from remote repository please make sure you have the correct access rights and the repository exists?

The Git “fatal: Could not read from remote repository” error occurs when there is an issue authenticating with a Git repository. This is common if you have incorrectly set up SSH authentication. To solve this error, make sure your SSH key is in your keychain and you connecting to a repository using the correct URL.

Does not appear to be a git repository │ fatal could not read from remote repository?

Note: The “fatal: 'origin' does not appear to be a git repository” error occurs when you try to push code to a remote Git repository without telling Git the exact location of the remote repository. To solve this error, use the git remote add command to add a remote to your project.


2 Answers

From Git's remote documentation, --delete should work with:

git remote set-url --push --delete origin [https://github.com/dpressey/barberapp.git]

because the syntax is --delete <name> <url> where <url> is a regular expression.


As a side note, it should be pointed that there is also git remote rm <name> that deletes every remotes matching the given name, whatever the URLs.

like image 99
Grégoire C Avatar answered Sep 24 '22 13:09

Grégoire C


If you want to reset the origin to a different url, you can directly override it:

$ git remote set-url origin ssh://yournewurl

and verify it using:

$ git remote -v
like image 39
Rohit Jain Avatar answered Sep 23 '22 13:09

Rohit Jain