How to change remote git repository using command line

How to change remote git repository using command line


In this article, we will be learning about how to change remote git repository using command line in GitLab.

So, Let's get started with it:


Step 1: Let's check current remote git repository name as follows: 

$ git remote -v

Output:

HP@HP-PC MINGW64 /c/xampp/htdocs/project
$ git remote -v
origin git@gitlab.com:user/repository1.git (fetch)
origin git@gitlab.com:user/repository1.git (push)

if you use HTTPS URL repository link, you will have to provide username and password with it.

Step 2: Now, lets change the remote git repository in gitlab using command line.

$ git remote set-url origin git@gitlab.com:user/repository2.git

if you use HTTPS URL remote repository link, then you will be asked to provide the username and password. 


Step 3: Now, you can start your project as flow with git pull and git push.


© Copyright - 2018 - 2021 | All rights reserved at Funda of Web IT