git - Files in .git folder have wrong permissions after pushing to non-bare repository (receive.denyCurrentBranch updateInstead)
问题描述
Setup
I have a git repository on my work computer and a clone on my laptop.
I set git config receive.denyCurrentBranch
to updateInstead
.
This way I can push from my laptop to my work computer and git automaticaly updates the local files in my work directory there.
My work computer uses a NFS file system and per defaut everyone in the group has read permissions.
On my laptop, I have the remote configured with username@computer:/home/path/to/git
My colleges have their remote configured using /path/to/home
The problem
Whenever I push to this non-bare repository, updated files in the .git folder (.git/refs/heads/master
, .git/objects/...
) get read permission for me, but not for the group. By default and before pushing, they had read permission for the group as well.
This way, my colleges cannot pull from my repository and get weird error messages.
The question
Is there some setting that I can change to change this behavior? Is this the intended behavior? Or is there no solution to this except for filing a bug/ feature request with the git developers?
解决方案
Remote URL username@computer:/home/path/to/git
means that you use SSH, not NFS. You need to configure umask
on the server side; try to edit it in /home/username/.bash_profile
at the work computer.
You're also recommended to set
git config core.sharedRepository 0640
in the shared repository to make git
to use this fixed umask
instead of users' umask
.
See https://git-scm.com/docs/git-config#git-config-coresharedRepository
推荐阅读
- python - 如何在python中使一个变量的值成为另一个变量的名称
- java - 在退出应用程序之前在片段上添加操作
- ecryptfs - eCryptfs - 相同的普通文件生成不同的加密文件
- php - PHP 致命错误:无法声明类 Emogrifier,因为该名称已在使用中
- sql-server - 如何获取数据库中存在的所有视图的列表及其记录数?
- python - 在python中将列表传递给具有可变数量的args的函数
- python-3.x - Python 3:从桌面打开 utf-8 文件
- c# - 在服务器端验证后保留用户的输入
- spring-integration - 保证消息传递网关有序启动和关闭的标准方法
- java - 使用休眠保存父表时在外键中插入空值