简体   繁体   中英

git clone, ignoring file

I want to clone a GitHub repo that has a giant .exe file in it. (why?!) I have zero use for the .exe file, and it is substantially bigger than everything else combined. Is there a way to ignore the file when I clone it?

My guess is that I would have better luck asking the author to make an exe-less branch! Hopefully there is some nice way around this though.

You can try a sparse checkout , which means:

  • initializing an empty repo,
  • add a remote pointing to the GitHub repo: git remote add -f origin <url> ,
  • git config core.sparsecheckout true ,
  • create a .git/info/sparse-checkout file in which you specify what you want to load.

In your case:

/*
!yourExe

You now can do a:

git pull origin master

That should download everything but your exe.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM