ApX logoApX logo
ModelsCalculatorHardwareCoursesPricing
ApX logoApX logo
ModelsCalculatorHardwareCoursesPricing

All Courses

Getting Started with Git
Chapter 1: Introduction to Version Control and Git
What is Version Control?
Why Use Version Control Systems (VCS)?
Centralized vs Distributed VCS
Introducing Git: A Distributed Approach
Core Git Concepts: Repository, Commit, Branch
Installing Git on Windows
Installing Git on macOS
Installing Git on Linux
Initial Git Configuration (user.name, user.email)
Getting Help with Git Commands
Quiz for Chapter 1
Chapter 2: Your First Git Repository
Creating a New Repository with git init
The Git Workflow: Modified, Staged, Committed
Checking the Status of Your Files (git status)
Adding Files to the Staging Area (git add)
Committing Changes (git commit)
Writing Good Commit Messages
Viewing Commit History (git log)
Understanding .gitignore Files
Hands-on Practical: Initialize and Make First Commit
Quiz for Chapter 2
Chapter 3: Viewing History and Undoing Changes
Comparing Changes (git diff)
Viewing Changes Between Commits
Viewing Staged vs Unstaged Changes
Unstaging Files (git reset HEAD )
Amending the Last Commit (git commit --amend)
Reverting Commits (git revert)
Removing Files from Git (git rm)
Moving or Renaming Files (git mv)
Practice: Inspecting and Modifying History
Quiz for Chapter 3
Chapter 4: Branching and Merging Basics
What Are Branches in Git?
Creating a New Branch (git branch)
Switching Between Branches (git checkout or git switch)
Listing Branches
Making Commits on a Branch
Merging Branches (git merge)
Understanding Fast-Forward Merges
Handling Merge Conflicts
Deleting Branches (git branch -d)
Hands-on Practical: Branching and Merging Workflow
Quiz for Chapter 4
Chapter 5: Working with Remote Repositories
Introduction to Remote Repositories
Common Hosting Platforms (GitHub, GitLab, Bitbucket)
Adding a Remote Repository (git remote add)
Viewing Remote Repositories (git remote -v)
Cloning an Existing Repository (git clone)
Pushing Changes to a Remote (git push)
Fetching Changes from a Remote (git fetch)
Pulling Changes from a Remote (git pull)
Understanding origin and upstream
Practice: Cloning, Pushing, and Pulling
Quiz for Chapter 5

Viewing Remote Repositories (git remote -v)

After you've connected your local repository to one or more remote repositories, or when you clone a project that already has remote connections, you'll often need to check which remotes are configured and where they point. Git provides a simple command for this purpose.

Listing Your Remotes

To see a list of the shortnames assigned to the remote repositories your local repository knows about, you can use the git remote command:

$ git remote
origin

This command lists the shortnames of each remote handle you’ve specified. If you cloned a repository, you will at least see origin. This is the default name Git gives to the server you cloned from. If you added remotes manually using git remote add, their shortnames will also appear here.

Viewing Remote URLs

While knowing the shortnames is useful, it doesn't tell you where these remotes are located. To see the URLs associated with each shortname, you can add the -v (or --verbose) option to the git remote command:

$ git remote -v
origin  https://github.com/user/project.git (fetch)
origin  https://github.com/user/project.git (push)
upstream	https://github.com/original-maintainer/project.git (fetch)
upstream	https://github.com/original-maintainer/project.git (push)

This output provides more detail. Each remote connection is listed twice: once for fetching (downloading data) and once for pushing (uploading data).

  • Shortname: This is the alias you use to refer to the remote (e.g., origin, upstream).
  • URL: This is the full address where the remote repository is hosted. It could be an HTTPS URL, an SSH URL (like [email protected]:user/project.git), or another protocol.
  • (fetch): Indicates the URL used when you run commands like git fetch or git pull to get changes from the remote.
  • (push): Indicates the URL used when you run git push to send your changes to the remote.

In many common scenarios, the fetch and push URLs for a given remote shortname will be identical, as shown for both origin and upstream in the example above. However, Git allows them to be different, which can be useful in specific setups (for example, read-only access for fetching, write access for pushing to a different location, although this is less common for beginners).

Running git remote -v is a fundamental step when working with remotes. It helps you:

  1. Verify Connections: Confirm that your local repository is correctly linked to the intended remote(s).
  2. Check URLs: Ensure the URLs are correct, especially if you encounter connection problems.
  3. Identify Shortnames: Remind yourself of the shortnames available for use in commands like git fetch origin or git push upstream my-feature-branch.

Knowing how to view your configured remotes is essential for managing your connections and collaborating effectively. It provides clarity on where your local project is connected and allows you to interact confidently with remote repositories.

  • git-remote(1) Manual Page, Git Project, 2024 - Official and comprehensive documentation for the git remote command, explaining its options and usage.
  • Pro Git, Scott Chacon and Ben Straub, 2014 (Apress) - An authoritative book chapter that details how to manage and interact with remote repositories in Git, including viewing remotes.
  • Managing remote repositories, GitHub Docs, 2024 - Practical guide from a leading Git hosting platform, providing real-world examples for managing remote connections.

© 2026 ApX Machine Learning