Bootstrap FreeKB - Git (Version Control) - Display repository details using the git remote command
Git (Version Control) - Display repository details using the git remote command

Updated:   |  Git (Version Control) articles

Before you can checkout, pull or fetch files, you'll need to use the git clone command to clone an origin Git repository to a directory on your local PC. The most basic way to use Git is to use the git clone command to clone an origin Git repository (such as example.git) to a directory on your PC (such as /home/john.doe/git), make a change to a file in the cloned repository on your PC (such as example.txt), use the git commit command to commit the change to the file, and to then use the git push command to upload the file to the origin Git repository.

 

The git remote command can be used to view the shorthand name of the repository that you have cloned. Typically, the shorthand name of the source Git repository is "origin".

~]# git remote
origin

 

The -v or --verbose flag can be used to include the full URL to the remote Git repository.

~]# git remote --verbose
origin  ssh://git@example.com:7999/path/to/example.git (fetch)
origin  ssh://git@example.com:7999/path/to/example.git (push)

 

The git remote show command will display even more details.

~]# git remote show origin
* remote origin
  Fetch URL: ssh://git@example.com:7999/midengops/example.git
  Push  URL: ssh://git@example.com:7999/midengops/example.git
  HEAD branch: master
  Remote branches:
    develop tracked
    master  tracked
  Local branch configured for 'git pull':
    master merges with remote master
  Local ref configured for 'git push':
    master pushes to master (local out of date)

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 87955e in the box below so that we can be sure you are a human.