I am working in a team environment, and there is already a .gitignore
file.
I want to add more items to the .gitignore
file, but I don't want to check this file in either. It is possible to set custom ignore files which only apply to me?
Also, I want to give someone read only access to a private git repository on our server, if I add their SSH key to our server they will get full access like everyone else. How can I limit it to read-only, no commits allowed.
Yes! Edit the exclude file to get repo specific ignore of files or file patterns. Great for scripts that I want to use for that repo and store in that repo, but don't want committed to the project at large, and don't want cluttering the . gitignore file that is shared by everybody.
gitignore file must be edited and committed by hand when you have new files that you wish to ignore. . gitignore files contain patterns that are matched against file names in your repository to determine whether or not they should be ignored.
Yes, unless that file was added before the . gitignore , or if it was force added.
.git/info/exclude
. See gitignore(5)
.git-daemon
, a web server, or Gitosis, or Gitolite.I know I am a little late to the conversation but you might want to consider using
git update-index --assume-unchanged [ FILE ]
As the git help document states:
When the "assume unchanged" bit is on, git stops checking the working tree files for possible modifications, so you need to manually unset the bit to tell git when you change the working tree file...
Emphasis mine. It goes on to say
This option can be ... used as a coarse file-level mechanism to ignore uncommitted changes in tracked files (akin to what .gitignore does for untracked files). Git will fail (gracefully) in case it needs to modify this file in the index e.g. when merging in a commit; thus, in case the assumed-untracked file is changed upstream, you will need to handle the situation manually.
So just keep in mind that you will have to be aware of any upstream changes made to these files.
In the event that you want to start tracking the file again all you have to do is use
git update-index --no-assume-unchange [ FILE ]
I hope this helps any future viewers of this post.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With