1

My code has some dependent libraries throw submodule, I clone the codes throw two ways:

git clone --recursive ***

or

git submodule update --init --remote --recursive

but neither of them works, after I clone the code, the size of dependent libraries are about 130 like this

-rw-rw-r-- 1 klen klen 130 Aug 25 11:51 libaddress_sorting.a
-rw-rw-r-- 1 klen klen 131 Aug 25 11:51 libares.a
-rw-rw-r-- 1 klen klen 133 Aug 25 11:51 libboringssl.a
-rw-rw-r-- 1 klen klen 132 Aug 25 11:51 libgpr.a
-rw-rw-r-- 1 klen klen 134 Aug 25 11:51 libgrpc.a
-rw-rw-r-- 1 klen klen 133 Aug 25 11:51 libgrpc++.a
-rw-rw-r-- 1 klen klen 133 Aug 25 11:51 libgrpc_abseil.a
-rw-rw-r-- 1 klen klen 133 Aug 25 11:51 libgrpc++_alts.a
-rw-rw-r-- 1 klen klen 131 Aug 25 11:51 libgrpc_csharp_ext.a

but their real sizes are

-rw-rw-r-- 1 klen klen     46850 Aug 10 15:32 libaddress_sorting.a
-rw-rw-r-- 1 klen klen    824784 Aug 10 15:32 libares.a
-rw-rw-r-- 1 klen klen  27209910 Aug 10 15:32 libboringssl.a
-rw-rw-r-- 1 klen klen   1213616 Aug 10 15:32 libgpr.a
-rw-rw-r-- 1 klen klen 172648038 Aug 10 15:32 libgrpc.a
-rw-rw-r-- 1 klen klen  52885946 Aug 10 15:32 libgrpc++.a
-rw-rw-r-- 1 klen klen  10001966 Aug 10 15:32 libgrpc_abseil.a
-rw-rw-r-- 1 klen klen  28759698 Aug 10 15:32 libgrpc++_alts.a
-rw-rw-r-- 1 klen klen    127288 Aug 10 15:32 libgrpc_csharp_ext.a

git version is 1.8.3.1, My question is why can not git clone the libraries fully?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Yongqi Z
  • 605
  • 8
  • 20
  • "Clone" is probably not the problem. It sounds like somebody messed up at "commit". SUGGESTION: 1) Copy your project, including the .a files, to a temp directory. 2) Create a NEW Git repo locally, in the temp directory. 3) Commit everything (git add ., then git commit -m "some msg") 4) Verify whether or not the .a files were saved correctly - and can be restored correctly - locally. 5) Post back what you find. – paulsm4 Aug 25 '22 at 05:19
  • 2
    It looks like those are git LFS pointers. Install git lfs on your computer and try again. – fredrik Aug 25 '22 at 06:05
  • @paulsm4 Probably not because of this, as I can download these libraries on other computers correctlly. – Yongqi Z Aug 25 '22 at 06:53
  • @fredrik yes, it works for me, I install `git-lfs` and it works now – Yongqi Z Aug 25 '22 at 06:54
  • Frankly, I never heard of "git-lfs" before. Good to know: +1. NOTE: git-lfs is an "extension"; it's definitely NOT an intrinsic feature of Git itself. I guess your remote repo was configured to use it ... but nobody ever gave you the memo. Interesting article: https://gregoryszorc.com/blog/2021/05/12/why-you-shouldn%27t-use-git-lfs/ – paulsm4 Aug 25 '22 at 17:32

2 Answers2

2

As @fredrik said, After install git-lfs, I can download the libraries fully.

curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.rpm.sh | sudo bash

sudo yum update

sudo yum install git-lfs

I am not sure if this installation method works for everyone, see this

Yongqi Z
  • 605
  • 8
  • 20
0

Check if this is linked to the http.postBuffer when those librairies were added and pushed.

But ideally, you would not add them to a Git repository in the first place.
Those kind of deliverables belongs to an artifact referential, like Nexus or Artifactory.
That way, you can add to your project a config file declaring your dependencies (like a pom.xml), instead of asking a source control system like Git to restore huge files.

The other approach would be to use Git-LFS, but it might not be fully supported by an old Git 1.8.x from a RHEL 7.x or 8.X.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250