How to store a git config as part of the repository?

ID : 20173

viewed : 20

Tags : gitgit

Top 5 Answer for How to store a git config as part of the repository?

vote vote

99

There are 3 supported scopes of .gitconfig file: --system, --global, --local. You can also create a custom configuration file, and include it in one of the supported files.

For your needs custom - is the right choice. Instead of writing your filter in .git/config you should save it in .gitconfig file in your repository root:

your-repo/ │ ├── .git/ │   ├── config │ ├── .gitconfig │ 

Create the .gitconfig with your filter and commit the changes. Then your colleagues will always keep it updated -- but they will have to include it manually. It is not possible to automatically include your custom configuration file through git alone, because it creates a security vulnerability.

To apply this configuration for a single repository, each user will need to run the following command in your-repo/:

git config --local include.path ../.gitconfig 

Reference: https://git-scm.com/docs/git-config#_includes

Be careful not to store personal data in the custom .gitconfig, like user.*, keep those in your global .gitconfig.

vote vote

83

You can not use .gitconfig file in a git repository by default, but you can link to it so the git config will be versioned.

You can link to it like that:

[include]   path = ../.gitconfig 

I have created a simple script gitconfig.sh which do it for you (much faster than copy) + simple .gitconfig file so if you want, take a look to this repo https://github.com/HoBi/dotfiles.


EDIT: I have deleted the file, but you can find it here https://github.com/tenhobi/dotfiles/blob/7e4376c006c508370b82bc7bd37173fab51dbd01/git/.gitconfig.sh

vote vote

76

vote vote

60

You can also use CSS3 PIE to resolve this issue:

http://css3pie.com/

Of course, that might be overkill if you're just depending on a single element with rounded corners and a background gradient, but it is an option to consider if you're incorporating a number of common CSS3 features on your pages and want easy support for IE6+

vote vote

57

I ran into this bug too. My suggestion would be to use a repeated background image for the gradient in ie9. IE9 correctly tiles the image behind the rounded borders (as of RC1).

I fail to see how writing 100 lines of code to replace 1 line of CSS is simple or elegant. SVG is cool and all, but why go through all that when easier solutions for gradient backgrounds have been around for years.

Top 3 video Explaining How to store a git config as part of the repository?

Related QUESTION?