开发者

Reset Git repository permission

开发者 https://www.devze.com 2023-03-03 15:48 出处:网络
I made a mistake today and performed a chmod 0644 in my git repository and soon I started getting permission errors. I had to chmod the .git directory to 0777 before I could use the repository again.

I made a mistake today and performed a chmod 0644 in my git repository and soon I started getting permission errors. I had to chmod the .git directory to 0777 before I could use the repository again. I compared the file permission with another git repo and found that different files have different permission in .git directory (default). Will the current 0777 crea开发者_StackOverflow中文版te any problem in future? How can I reset the repo to default permissions?

I am referring to the files in the .git repository and not the files under version control


One thing that could cause a problem is the hooks directory, because when the scripts have an executable flag, they will be executed. So I would remove the executable flag from those files.

I don't think other files are a problem other then that every use on your computer can read and alter them.

You can clone the repository to create a new repo with all the correct rights set. But you have to manually copy the .git/config file over to the new repository, because that doesn't get copied over.


Been there, done that. What I did was dump the history of the repo (changesets/patches really), create a new empty repo and load the changesets with date/timestamps. Worked like a charm. I'm sure there are easier methods though.

0

精彩评论

暂无评论...
验证码 换一张
取 消