Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Privacy of .gitignore when pushing or cloning repositories?

Tags:

git

When I push my local repository to a remote repository, my local .gitignore file will be pushed to the remote as well.

When someone clones my repository, they will copy my .gitignore file as well.

The files I put inside .gitignore might be private, so are the names of the files. So I wonder if it is a good idea that my .gitignore file is pushed or copied into a different repository? Generally, is .gitignore file supposed to be private itself?

Can we make it not pushable or clonable?

like image 681
Tim Avatar asked Nov 22 '25 12:11

Tim


2 Answers

For private excludes you can use .git/info/exclude which has the same syntax and, basically, works the same way, but is not stored in the repository.

Also there is core.excludesFile (see man git-config) for your own global (that is, not per-repository) excludes.

like image 59
kirelagin Avatar answered Nov 24 '25 21:11

kirelagin


If you do not git add your .gitignore file, it won't be part of the index, and hence, never be pushed to a remote.

The fact that you push your .gitignore file means that you added it -- I don't even think git add --all does that by default; so, basically, it's your fault for manually adding it in the first place.

like image 20
Marcus Müller Avatar answered Nov 24 '25 20:11

Marcus Müller



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!