git.pngGit

Git Remote

In this article, we will learn How to use Git Remote command.

Total Views:   1417


In this article, we will learn How to use Git Remote command. In Git, Remote Repositories are the project hosted on the internet or in the network. Some of the Popular git remote repositories are GitHub, Bitbucket, GitLab, etc. Git Remote Repositories are very useful while working on a project with the team. Multiple operations like fetch, push, pull, clone, etc. are used to keep the local repository in sync with the team during collaboration. With the Remote command, we can add. View, rename, and delete the connection to the remote repository. Remote is like the bookmark for managing remote connections. In this article, we will cover the below topics.

1. How to view a Remote configuration?

2. How to add a Remote configuration?

3. How to Inspect a Remote Configuration?

4. How to rename the Remote configuration?

5. How to delete or remove the Remote configuration?

Note: Remote Repository can also be on your local system.

 

1. How to view a Remote configuration?

Use the “git remote” command to check the configured remote servers. If you cloned a repository on your local system, in that case you will see at least origin remote.

 

In the above image, we cloned a remote repository on the local system and checked the available remotes with the “git remote” command. You can also use “git remote -v” to view the URLs of the Git repository used for reading (fetch) and writing (push) for the remote.

 

2. How to add a Remote configuration?

Use “git remote add <Remote_Name> <Remote_URL>” to add a new remote Git Repository with a short name that can be used for reference. In the below example, we added a new remote configuration with the “git remote add” command.

 

3. How to Inspect a Remote Configuration?

If you want to view more information for the remote configuration, use “git remote show <Remote_Name>” command.

 

4. How to rename the Remote configuration?

Use “git remote rename <Old_Remote_Name> <New_Remote_Name>” to change the remote’s short name. In the below image, I renamed the remote name from “otherremote” to “testremote”.

 

5. How to delete or remove the Remote configuration?

If you want to delete or remove any remote configuration, use the “git remote remove <Remote_Name>” or “git remote rm <Remote_Name>” command.