To build a connection between Git remote and the local repository, the “$ git clone <remote-URL>” command can be used. A Git user can also view the whole information about the remote repository with the “$ git remote show origin” command.
This guide will demonstrate how to show information about a remote repository in Git.
How to Show Information About Remote Repository in Git?
Usually, a Git local repository is tracked with the Git remote repository. Moreover, you can also view the information related to the remote repository. For the corresponding purpose, we will first clone the Git remote repository and then view its complete detail.
Let’s check out the provided procedure!
Step 1: Open Git Terminal
Launch the “Git Bash” on your system with the help of the “Startup” menu:
Step 2: Move to Git Directory
Navigate to the selected Git directory:
Step 3: Copy Remote URL
Open the GitHub host service, go to the corresponding remote repository, click on the “Code” button, and copy the “HTTP” link on the clipboard:
Step 4: Clone Remote Repository
Next, execute the “git clone” command with paste the remote repository link:
According to the below output, we have successfully cloned the “Linux-repo” remote repository:
Step 5: Navigate to Remote Repository
Now, navigate to the cloned repository by utilizing the “cd” command:
Step 6: Show Remote Repository Info
Lastly, execute the “git remote” command with the “show” option:
Here, the above command, showed the details about the remote repository, such as the remote name “origin”, “Fetch URL”, “Push URL”, HEAD branch “main”, and remote branches name:
How to View the Remote URL?
Sometimes users are required to use the remote URL; therefore, they only want to view it. For this specified purpose, execute the “git config” command with the “–get” option to get the remote URL:
That’s it! We have provided the instructions for showing information about the remote repository in Git.
To show information about remote repositories in Git, open the Git terminal and move the folder. Next, copy the remote repository URL from GitHub to the clipboard. Then, execute the “$ git clone <remote-URL>” command and clone it to the local Git local repo. Lastly, execute the “$ git remote show origin” command to view all info about the remote repository. To just view the remote URL, run the “$ git config –get remote.origin.url” command. In this guide, we have illustrated how to show information about a remote repository in Git.