Reputation: 41
The title might be a bit misleading. The purpose is to make a simple bash tool to change a link into a build_options.txt file by using a token (and not giving access to anyone else to the repo, or at least very limited). It needs to be on a specific branch (so -b i think is there) and then build a menu or give some options. After this on the remote i'll be needing that edit in order to build.
I believe the cloning is required, but in reality the need is only to modify that build_options.txt. I tried with --sparse but it seems complicated, and i'm not an advanced git user. Git version used is 1.9.1. Access is both ssh and https.
In short: run this script, have a local copy of build_options.txt and nothing more, then a git push origin or something similar must be possible in a different one-time-purpose branch. Cheers!
Upvotes: 0
Views: 236
Reputation: 488589
Git version 1.9.1 is very old—current Git is 2.26 with 2.27 coming soon—and even in Git 2.27, the partial clone code is not ready for ordinary-people-use. In Git versions before 2.17, partial clone doesn't exist. What this all means is that you literally cannot clone a single file.
Git is built around commits. Each commit contains a full snapshot of every file. To get a single file, you get an entire commit which gets you every file. To make a new commit, you must write a commit that stores every file, so even if you installed the latest Git and used partial clones, you'd still need to get a pretty-full clone, so that you have the latest version of every file. There is no other option: you must get every file.
You can make a shallow clone, if you like; shallow clone support should work well even in ancient Git 1.9.1, I think.
In any case, once you have every file, you might as well just go with that: check out the commit, create a branch name, modify the one file, git add
the one file, and git commit
to make a new snapshot of every file. You can now git push
this one new commit to a new branch on origin
.
Upvotes: 1