Skip to content

Set Origin URL

Overview

When you change the namespace of repository, this will make the different between origin URL of remote (GitHub repository URL) with the local of that space. In order to make things set to the new origin URL, using following script:

Step 1: Verify the local remote origin

cat .git/config
# [core]
#   repositoryformatversion = 0
#   filemode = false
#   bare = false
#   logallrefupdates = true
#   symlinks = false
#   ignorecase = true
# [remote "origin"]
#   url = https://github.com/thuyetbao/FinSpace
#   fetch = +refs/heads/*:refs/remotes/origin/*

Step 2: Change the local with the new origin URL

# Syntax: git remote set-url origin <new-origin-url>
git remote set-url origin https://github.com/thuyetbao/space

Step 3: Verify back the local config

cat .git/config
# [core]
#   repositoryformatversion = 0
#   filemode = false
#   bare = false
#   logallrefupdates = true
#   symlinks = false
#   ignorecase = true
# [remote "origin"]
#   url = https://github.com/thuyetbao/space       <----- This is where the change happened ---->
#   fetch = +refs/heads/*:refs/remotes/origin/*

Step 4: Try to a new commit to the new space.

Reference