QandA
QandA

Reputation: 55

Github error "fatal: remote origin already exists."

I'm trying to follow a bottega tutorial but I ran into this error. I have looked at other similar questions but none of the answers seem to work for me. I'm using rails 5 but when I try the following line it gives me the error

git remote add origin https://github.com/MyName/my_view_tool.git

I was wondering if anyone new how to fix this? One of the common answers I saw was the following but it did not work for me.

git remote set-url origin [email protected]:MyName/my_view_tool.git

Upvotes: 1

Views: 3052

Answers (2)

Donald Chiang
Donald Chiang

Reputation: 167

You have already add a remote named origin, find your .git folder in project root path and edit the config file in .git folder, replace the origin url to GitHub url, config file like this:

[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
        ignorecase = true
        precomposeunicode = true
[remote "origin"]
        url = [ORIGIN_URL_HERE]
        fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
        remote = origin
        merge = refs/heads/master

Upvotes: 2

zwippie
zwippie

Reputation: 15525

Open up .git/config in your favourite editor and manually change the url of the remote repository, it's under [remote "origin"].

Upvotes: 0

Related Questions