Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

How can I make directory read-only with git?

The situation is - in project, I have a symlink to shared framework. I don't want it to be overwritten/changed in any way (not even mtime or atime).

How can I do that - or am I viewing the thing from wrong perspective?

share|improve this question
    
A checkout usually does not touch untracked files in the working directory. Maybe I am missing your point. –  Marco Aug 6 '12 at 20:05
    
Good point. But the files have to be tracked, because when I push them to let's say github, I want others to be able to pull them. –  Rok Kralj Aug 6 '12 at 20:06
    
You want to have the symlink tracked or what it points to or both? You can't prevent people from changing files if they have commit access. –  lynxlynxlynx Aug 6 '12 at 21:29

2 Answers 2

For a specific directory, it is not possible (probably i am not right). For example, if user runs the following commands

git fetch --all
git reset --hard origin/master

or

git reset --hard HEAD
git pull

For details,

Git manual page may help you

share|improve this answer

First of all this question is probably more suited for programmers.se. And yes you are in my opinion viewing it from the wrong perspective.

It basically boils down to dependency management. You should just use the commonly used tools of your language/framework to express dependencies instead of copying/symlinking other projects.

If you really need/want to reference other git repositories you should use git submodule instead of requiring symlinks to other repositories.

The better and cleaner approach is to use the package-management of your distribution for the dependency management, rpm or dpkg or just let your build system or tools take care of the dependencies, like e.g.: maven, bundler, carton, openembedded.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.