git remote
- Git course
- Intermediate
- Lesson 25/82
- 4 min
Learn the remote list with git remote.
Listing Remote Repositories
The git remote command lists the names of remote repositories connected to your local repository. When you clone a GitHub repository or add a remote, there is usually a remote named origin.
git remote
originThis command is sufficient to see only the names of remote repositories.
Viewing Remote Repository URLs
The git remote -v command displays both remote names and their URLs. The fetch URL is used to retrieve data, while the push URL is used to send changes.
git remote -v
origin https://github.com/user/project.git (fetch)
origin https://github.com/user/project.git (push)The two URLs can be the same, but different URLs can also be configured when needed.
Practice Display Remote Names
Run git remote in a Git repository. Then enter the command that displays the remote name origin.
Starter code
# Uzak depo adını gösterExpected output
origin
Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 What does the git remote command list?
- All files in the repository
- The contents of existing branches
- The names of connected remote repositories Correct answer
- The local commit history
Explanation: <code>git remote</code> displays only remote names. A different option is used to display remote repository URLs.
2 List Remote Repositories in Detail
git remote ____
git remote -v
Explanation: The <code>-v</code> option displays remote names and URLs together.
3 Remote Listing Concepts
| Term | Meaning |
|---|---|
git remote |
Lists remote names |
git remote -v |
Displays URLs too |
origin |
Common remote name |
fetch |
Retrieves data from remote |