I've just started using git-ftp, which allows me to push my commit to an FTP server.
The FTP credentials are stored in .git/config in this way:
[git-ftp]
user = myusername
url = ftp.myserver.com/httpdocs/
password = mypass
What I would like, is that anyone who clones the project from my git repository, automatically gets the configuration above as well.
But how can I 'push' this git configuration to my repo?
Read more about git-ftp: https://github.com/resmo/git-ftp
This is not possible as explained in this SO answer. Git config file is always local to a repository, and can't be pushed or fetched. Best solution is to put a file containing the git-ftp parameters (excepted the password), and display instructions in a README.
I think, generally, if we are talking about the plain Git, you could dedicate a special Git branch for storing your configs, say, git-config
. Probably it will be disconnected from all your other history in this repo.
And write special programs to save your current config as a commit in that branch, and to retrieve the config from there.
Then, if you push that branch somewhere, and tell them to use your save-and-retrieve programs, they'll have it. If you clone your repo somewhere, too, your config will be available in the new repo in the special branch. You only need to use the script to retrieve it from there.
You can even merge different configs with Git then.
Somee programs that extend Git like git-annex use this approach; their per-repo data is stored in a special branch, and thus can be exchanged and merged by Git.
(Of course, it's a bad idea to publish the password through VCS.)