Simple Fellow
Simple Fellow

Reputation: 4622

What location Git uses while cloning the objects?

I ran the git clone command on a very large code repository. What happens that it asks for passwords, starts cloning and then in the middle it stops.

until that time it shows the message receiving objects something around 500 or 600 MiB. But when I check the folder there is absolutely nothing. it is blank.

cloning into '.'...
Password for xxxxxxxxx: 
remote: Counting objects: 146645, done.
remote: Compressing objects: 100% (36723/36723), done.
remote: Total 146645 (delta 109568), reused 142817 (delta 107322)
Receiving objects: 56% (146645/146645), 1.17 GiB | 1.78 MiB/s

<some errors>

so where does the Git receives these objects? Does it take space on my file system? if so, how can I clean it since it failed to download anything.

Upvotes: 0

Views: 273

Answers (2)

Tyler Szabo
Tyler Szabo

Reputation: 1016

Yes, they'll take up space on your filesystem.

They'll most like be in .git/objects, though I've somehow accidentally made a ..git directory before (I have no idea how, I just saw the directory). They might also be in ./objects if GIT_DIR was ..

Without knowing the specific errors it's not clear what else might be happening but it's not impossible for the branch you have checked out in your worktree to be one where the last commit "deleted everything" or for the worktree to have not been checked out at all (so the repo was cloned but it wasn't able to create the worktree).

Upvotes: 2

ElpieKay
ElpieKay

Reputation: 30878

Open two consoles, and run the clone command in one and observe in the other. You will find a folder with .git is created at once. Enter the folder and run du -h . repeatedly or in a loop, you will see its size stays the same. But once it starts Receiving objects, .git will continuously enlarge. The received objects are being stored in .git.

When you interrupt the command or it fails, the folder and .git will be removed automatically. If in some rare cases they are not removed automatically, you can remove the folder to clean it up.

Upvotes: 2

Related Questions