Gangmax Blog

Change Git Remote URL

The requirement is to update the origin SSH URL to HTTPS URL of a given git repo. Please read the following commands to get the details. From here.

1
2
3
4
5
6
7
8
9
10
11
12
13
> git remote -v
origin git@git.jiade.com:business-intelligence/shide-web.git (fetch)
origin git@git.jiade.com:business-intelligence/shide-web.git (push)
# Method 1(remove existing URL and add new one):
> git remote remove origin
> git remote -v
> git remote add origin http://git.jiade.com/business-intelligence/shide-web.git
> git remote -v
origin http://git.jiade.com/business-intelligence/shide-web.git (fetch)
origin http://git.jiade.com/business-intelligence/shide-web.git (push)
>git branch --set-upstream-to=origin/feature-working-branch-round12-hg feature-working-branch-round12-hg
# Method 2(replace existing URL):
git remote set-url origin http://git.jiade.com/business-intelligence/shide-web.git

Comments