Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is git clone not copying source files to my local directory?

Tags:

git

git-clone

ssh

I'm running into issues using git clone. When I run the command to clone a repository, the git command looks like it completes successfully.

git clone ssh://[email protected]:29418/sourceName

I get the following results:

ssh://[email protected]:29418/sourceName
Cloning into 'sourceName'...
Warning: Permanently added '[192.168.2.4]:29418' (RSA) to the list of known hosts.
remote: Counting objects: 14091, done
remote: Finding sources: 100% (14091/14091)
remote: Total 14091 (delta 10639), reused 13901 (delta 10639)
Receiving objects: 100% (14091/14091), 84.60 MiB | 204.00 KiB/s, done.
Resolving deltas: 100% (10639/10639), done.
Checking connectivity... done.

So, it looks like it's cloning successfully. But when I look at the target folder, I see only the .git folder gets created and populated.

No source files get copied locally as part of the clone.

I don't see any error messages. What could be going wrong? How do I "debug" this?

Thanks, JohnB

like image 224
JohnB Avatar asked Dec 08 '25 08:12

JohnB


1 Answers

  1. First, git said it received 84.6 MiB of objects, so sanity check: du -hs .git/objects

  2. If it's empty, perhaps you are not actually in the target folder.

  3. If it's not empty, git log --all. This just asks git log to follow all refs from refs/.

    You might discover that the source files were there before, but were removed in a subsequent commit. If so, just git checkout to an older commit.

    Also possible that there's simply no files in the master branch (git log --all will show other branches). See git branch for list and git checkout another branch.

  4. If that's empty, manually inspect .git/refs/heads, .git/refs/remotes, and finally .git/objects. GitHowTo has a good overview of .git directory structure.

like image 71
szym Avatar answered Dec 10 '25 00:12

szym



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!