Git verbose clone

Greg Foster
Greg Foster
Graphite software engineer


Note

This guide explains this concept in vanilla Git. For Graphite documentation, see our CLI docs.


The verbose mode (-v or --verbose) of the git clone command can be particularly useful in scenarios where you need more detailed feedback about what the command is doing. This mode is especially beneficial when you want to troubleshoot or confirm the behavior of the Git process during the cloning operation.

Enabling verbose mode logs additional details about the cloning process, which could include information about the objects being received, the remote repository being queried, and any other diagnostic information relevant to the cloning process.

Here’s why and when you might want to use verbose mode:

  • When cloning a repository, especially from a new source or over potentially unreliable networks, connection issues can arise. Using verbose mode provides more information about the network operations that Git is performing, helping identify at what point in the process issues might be occurring.
  • Git’s verbose mode offers more detailed output regarding the steps Git is taking as it clones the repository. This includes the negotiation of features between the client and server, references being updated, and files being downloaded. It helps you understand the progression, especially with large repositories where the clone process might take significant time.
  • For more complex Git setups, such as those using custom configurations or hooks, verbose output can help verify that all parts of the configuration are activated and processed correctly during the clone. It shows how configuration directives influence the cloning process.
  • For those learning Git or teaching it, using verbose mode can provide insights into what happens "under the hood" when a repository is cloned. This can be an excellent educational tool to show the sequence of operations performed by Git.
  • When integrating Git operations into scripts or automation tools, verbose output can be logged and analyzed later. It ensures that the clone operation proceeded as expected without having to perform manual checks.

To demonstrate how to use git clone -v and interpret its output, let’s walk through an example of cloning a sample repository. We'll use a hypothetical repository URL: https://github.com/example/repo.git. Below is what you might see in your terminal when you run the command, and an explanation for each line of output.

Open your terminal and type the following command:

Terminal
git clone -v https://github.com/example/repo.git

Here's a typical output you might see:

Terminal
Cloning into 'repo'...
POST git-upload-pack (176 bytes)
remote: Enumerating objects: 28, done.
remote: Counting objects: 100% (28/28), done.
remote: Compressing objects: 100% (24/24), done.
Receiving objects: 100% (28/28), 10.01 KiB, done.
Resolving deltas: 100% (8/8), done.
Checking connectivity: done.

Now, let's break down what each line means:

  1. Cloning into 'repo'...

    • Explanation: This indicates the start of the cloning process. Git is initializing a new directory named repo (derived from the repository name) on your local machine to hold the repository's contents.
  2. POST git-upload-pack (176 bytes)

    • Explanation: This line is part of Git’s internal mechanism for fetching data from the remote repository. It involves a POST request for the git-upload-pack service, which asks the remote server to package and send the required repository data. The size of the request (176 bytes in this case) is also shown.
  3. remote: Enumerating objects: 28, done.

    • Explanation: The remote server is listing all the objects in the repository that need to be transferred. This particular repository has 28 objects.
  4. remote: Counting objects: 100% (28/28), done.

    • Explanation: Git has finished counting all 28 objects in the repository that are going to be transferred. The counting is done to prepare for the data transfer.
  5. remote: Compressing objects: 100% (24/24), done.

    • Explanation: Before transferring, Git compresses the objects to reduce the amount of data that needs to be sent over the network. Here, all 24 objects that can be compressed have been compressed.
  6. Receiving objects: 100% (28/28), 10.01 KiB, done.

    • Explanation: This line indicates that your local Git client is receiving the objects from the remote repository. All 28 objects have been received, totaling 10.01 KiB.
  7. Resolving deltas: 100% (8/8), done.

    • Explanation: After the objects are received, Git needs to apply changes (deltas) to reconstruct the versions of the files. Here, all 8 deltas have been resolved.
  8. Checking connectivity: done.

    • Explanation: This final step checks that all objects are now correctly linked and accessible in your local repository setup. This ensures that the clone operation has completed successfully without any missing data.

For further reading on git clone including it's verbose option, see the official git documentation.

Graphite
Git stacked on GitHub

Stacked pull requests are easier to read, easier to write, and easier to manage.
Teams that stack ship better software, faster.

Or install our CLI.
Product Screenshot 1
Product Screenshot 2