This article discuss specifically on how to display the definition of the already added or the available remote URL target or destination of a Git repository. Supposed, if there is an already defined folder which is associated or initialized as a local Git repository, in order to push or to send any files or folder located inside of the folder itself to a remote Git repository server, the location of that remote Git repository server must be defined at the beginning. So, first of all, before adding, committing or pushing files or folder contained in the folder, using git command, check the remote URL via command using the git command itself.
The pattern command for git to check the remote URL via command is shown below :
git remote -v
But to be more detailed, first of all please not to forget to initialize or to associate the folder with Git version control. To be able to do that, just read the following article titled ‘Setup a Git Repository via Command Line‘ which can be visited in this link . So, after successfully associated or initiated the folder, the above command specified for checking remote Git repository can be executed. Below is an example of the commad execution in an already associated or initiated folder with Git version control. Don’t forget to execute it inside the folder itself :
user@hostname:~/Office/Infrastructure/Infrastructure$ git remote -v infrastructure http://mydev.com/gitlab/user/infrastructure.git (fetch) infrastructure http://mydev.com/gitlab/user/infrastructure.git (push) origin http://mydev.com/gitlab/hamdi/infrastructure.git (fetch) origin http://mydev.com/gitlab/hamdi/infrastructure.git (push) user@hostname:~/Office/Infrastructure/Infrastructure$
The output generated above off course is different with the fresh and new associated or initiated folder with Git control. If it is fresh and new, the output of the command will not provide the list of remote URL definition at all or it will produce no output at all. If it has already been added, then it will have the output as shown in the above. This is the output which is produced in an already initiated folder with Git version control :
user@hostname:~/test$ git remote -v user@hostname:~/test$
2 thoughts on “Check Remote URL Git Repository via Command Line”