Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

the git clone is empty? why this happens

Tags:

git

git-clone

This always perplexes me. I was cloning this

git clone https://android.googlesource.com/kernel/msm.git 

And It seemed to be cloning resolving and receiving objects etc for long . Then when it is done...

git clone https://android.googlesource.com/kernel/msm.git Cloning into msm... remote: Counting objects: 1636832, done remote: Total 1636832 (delta 1367313), reused 1636832 (delta 1367313) Receiving objects: 100% (1636832/1636832), 324.89 MiB | 331 KiB/s, done. Resolving deltas: 100% (1367314/1367314), done. 

I open the msm directory to find it empty. This has happened before. Any one has an explanation as to what went wrong?

like image 593
sraddhaj Avatar asked Jan 25 '12 14:01

sraddhaj


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.

Can we clone an empty repository?

Cloning an empty repository An empty repository contains no files. It's often made if you don't initialize the repository with a README when creating it. On GitHub.com, navigate to the main page of the repository. To clone your repository using the command line using HTTPS, under "Quick setup", click .

What happens with git clone?

git clone is primarily used to point to an existing repo and make a clone or copy of that repo at in a new directory, at another location. The original repository can be located on the local filesystem or on remote machine accessible supported protocols. The git clone command copies an existing Git repository.

Does git clone get all history?

Cloning an entire repo is standard operating procedure using Git. Each clone usually includes everything in a repository. That means when you clone, you get not only the files, but every revision of every file ever committed, plus the history of each commit.


2 Answers

This particular git repository seems to not have any contents on its master branch, which is the branch git checks out by default. It does however have another branch:

% git branch -a * master   remotes/origin/HEAD -> origin/master   remotes/origin/android-msm-2.6.35   remotes/origin/master 

So if you check out this branch:

% git checkout android-msm-2.6.35 Checking out files: 100% (33866/33866), done. Branch android-msm-2.6.35 set up to track remote branch android-msm-2.6.35 from origin. Switched to a new branch 'android-msm-2.6.35' 

then there's also content in the working tree.

like image 54
Mika Fischer Avatar answered Oct 04 '22 06:10

Mika Fischer


After your first clone, if you have directories that are submodules of the parent repo, you need to initialize them with:

git submodule update --init 

Using git submodule update --init --recursive will also be needed if there are submodules inside submodules.

like image 41
Dylan Kapp Avatar answered Oct 04 '22 06:10

Dylan Kapp