문제

Is there any good way to handle permission to single files in git repository?

I have .net project which I want to share with my team. What I don't want to share are connection strings to production db, storage and so on.

I know I could create new branch with these files, but it's getting much more complicated.

도움이 되었습니까?

해결책

You shouldn't add sensitive data to your repository to start with. Instead, add the respective filenames to .gitignore so you never accidentally commit them.

If you really have to have the files in the repository, use a githook to encrypt the files before committing and decrypt on checkout only if the correct key is present. Here's a starting point for that. edit In case you really want to do this, git-crypt sounds helpful

다른 팁

The real answer is that you should not have any sensitive data embedded in your code like this. Connection strings should be read at runtime from some configuration storage (of any like, be in app.config or an INI-file or whatever else), and if you settle on configuration files, you should only keep in the repository samples for these files which are for the reference only.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top