I am looking into adding some files to .git repo directory, and push them to the upstream
without tracking/commiting them.
Example:
.git/information.txt
After I do a commit, I add text to information.txt, and then push.
When I clone/fork I would like to still have this file in .git.
What I basically want is to have files that are not tracked, and the content in the upstream is updated with the existing content in the local repo when git push is issued.
I guess the way to do it is to hack the git-init and add whatever I want, and see what git push/clone/fork does to the .git folder, and keep the new files and send them to upstream. But I am thinking that maybe there is another way.
Is there a config option that I am missing?
Long story short:
You can't.
The remote repo is more or less a mirror of your local repo.
Git is not a file transfer tool but a version control system.
In order to be able to push something out to the remote repo, the file has to be present (read: versioned) in the local repo.
What you're trying to achive is not possible with Git.
The closest you can get is to have a local branch
fullthat contains the file and another local branchstrippedthat doesn't hold the file.If you
git push <remote> full, theremotebranch will hold the file.Your work would be done in the
strippedbranch not holding the file.But as earlier said: this is basically not something you want to do with Git.