Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error when cloning git "shallow" repository

Tags:

git

I'm getting the following error when issuing the command git clone --bare /path/to/repo:

fatal: attempt to fetch/clone from a shallow repository

First, what is a shallow repository and why doesn't it let me clone it?

like image 702
Olivier Lalonde Avatar asked Jan 22 '11 20:01

Olivier Lalonde


People also ask

Why git clone is not working?

If you have a problem cloning a repository, or using it once it has been created, check the following: Ensure that the user has gone through initial GitCentric login and has the correct username, email, and ssh. This should return a usage message that refers to the config-branch, config-repo, and ls-repo commands.

What does shallow clone mean?

Shallow Cloning: Definition: "A shallow copy of an object copies the 'main' object, but doesn't copy the inner objects." When a custom object (eg. Employee) has just primitive, String type variables then you use Shallow Cloning.


Video Answer


2 Answers

Rename .git/shallow to something else, clone, rename it back, copy .git/shallow to cloned repository

like image 67
Harvie.CZ Avatar answered Sep 20 '22 03:09

Harvie.CZ


A shallow repository is a repository which does not contain the full history.

See the git-clone manpage:

--depth

Create a shallow clone with a history truncated to the specified number of revisions. A shallow repository has a number of limitations (you cannot clone or fetch from it, nor push from nor into it), but is adequate if you are only interested in the recent history of a large project with a long history, and would want to send in fixes as patches.

like image 33
ThiefMaster Avatar answered Sep 24 '22 03:09

ThiefMaster