I cannot clone git tree
Git cannot clone a tree directly. You need to clone the entire repository, and then check out a commit that uses the tree you want. For the sake of reducing confusions, though, do note that there is a difference between the terms "tree" and "commit", though:
- A tree is a Git object representing a directory, and contains links to blobs (files) and other trees. A tree is not necessarily the root directory of the repository.
- A commit object contains a link to the root tree of the repository, and some extra information such as commit message, dates and other headers.
You can only check out commits. Few Git commands deal directly with tree objects (git cat-file
and git ls-tree
being among the exceptions). However, the object ID in your GitHub URL is indeed the ID of a commit, so that's not a problem.
What you can do, then, is check out the commit you want into a new branch after you've cloned the repository:
git checkout -b test-branch d2077e21
If the problem you're trying to solve is just fetching a single commit (or tree) from a remote repository, then you're out of luck, because Git's remote protocol does not support that operation. If anything, if you can insert a branch into the remote repository at the commit you want, you can clone that branch directly, without any history:
git clone -b test-branch --depth 1 https://github.com/cer/event-sourcing-examples
If you can't do that, however, then you're still out of luck. The remote protocol only allows referencing named refs, not arbitrary commits.
Why cant I clone repository from GitHub
I managed to bypass the issue by using Github Desktop
Git Clone - Repository not found
If you are using two factor authorization (2FA) for your Github account then just use SSH option for cloning your repository:
GitHub: Clone succeeded, but checkout failed
When you clone, git gets all the objects from the remote end (compressed and stashed into the .git
directory). Once it has all the pieces, it proceeds to unpack all files needed to (re)create the working directory. It is this step that fails, due to not having enough space. This might be due to a disk that is full, or a disk quota exceeded (on shared machines, quotas are often enforced to avoid having users grab more than their fair share of space).
Delete your cruft. Make sure you aren't trying to squeeze the Linux kernel or some such monster repository into your few megabytes of account space.
Related Topics
Using Mkdir -M -P and Chown Together Correctly
How to Move a Relative Symbolic Link
Run ASP.NET Core App Under Linux on Startup
Curl Does Not Work But Same Site Works with Browser
All Newlines Are Removed When Saving Cat Output into a Variable
Chmod - Protect Users' File Being Accessed So Only Owner Can Access
How to Wake Select() on a Socket Close
Save in a Variable The Number of Seconds a Process Took to Run
Granting Access Permission to a File to a Specific User
Trying to Statically Link Boost
How to Enable Tab-Completion of Command Line Switches in Bash
Apache Webserver - How to Write to Dir/Files with Permissions Set at 755 Instead of 777
Linux Kernel: What Process Does Schedule() Run In
Socat Terminates After Connection Close
Linux Bash: Setting Iptables Rules to Allow Both Active and Passive Ftp
Replace Text Between Two Strings in File Using Linux Bash
What Is a Way to Read Man Pages in Vim Without Using Temporary Files