我正在使用Git和團隊。我們已經建立了一個裸倉庫,我們將它視爲私人* nix服務器上的「中央」存儲庫。配置Git,使文件具有正確的權限
爲了確保只有我的合作者,我可以使用的存儲庫,我爲我們創造的服務器上的用戶組:
$ mkgrp ourproject
然後在服務器上創建一個裸Git的回購,並設置其權限並適當分組:
$ newgrp ourproject # Create new files as the correct group
$ umask 007 # Members of the group and I can do anything to the files; no one else can
$ git init --bare
$ ls -l
drwxrwx--- 2 knorth ourproject 2 May 13 16:15 branches
-rwxrwx--- 1 knorth ourproject 66 May 13 16:15 config
-rwxrwx--- 1 knorth ourproject 73 May 13 16:15 description
-rwxrwx--- 1 knorth ourproject 23 May 13 16:15 HEAD
drwxrwx--- 2 knorth ourproject 10 May 13 16:15 hooks
drwxrwx--- 2 knorth ourproject 3 May 13 16:15 info
drwxrwx--- 15 knorth ourproject 15 May 18 20:48 objects
drwxrwx--- 4 knorth ourproject 4 May 13 16:15 refs
到目前爲止,這麼好。
但是,當我推送到Git存儲庫時,存儲庫中新對象的權限設置爲-r--------
而不是-rwxrwx---
,正如我所料。此外,新文件正在分配給一個名爲grad
的組,該組屬於我所屬的其他組之一,而不是ourproject
組。
在我的本地機器上,我推了變化:
Kevins-MacBook-Pro:cloned-repo ThePondermatic$ git push
Password:
Counting objects: 9, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (8/8), done.
Writing objects: 100% (9/9), 111.01 KiB | 0 bytes/s, done.
Total 9 (delta 0), reused 0 (delta 0)
To [email protected]:/home/repo/location
11fb73c..d9c0db4 master -> master
然後,在服務器上:
$ ls -lR # Show the permissions for all files in the bare repo
.:
total 20
drwxrwx--- 2 knorth ourproject 2 May 13 16:15 branches
-rw-rw---- 1 knorth ourproject 66 May 13 16:15 config
-rw-rw---- 1 knorth ourproject 73 May 13 16:15 description
-rw-rw---- 1 knorth ourproject 23 May 13 16:15 HEAD
drwxrwx--- 2 knorth ourproject 10 May 13 16:15 hooks
drwxrwx--- 2 knorth ourproject 3 May 13 16:15 info
drwxrwx--- 15 knorth ourproject 15 May 18 20:48 objects
drwxrwx--- 4 knorth ourproject 4 May 13 16:15 refs
./branches:
total 0
./hooks:
total 26
-rwxrwx--- 1 knorth ourproject 452 May 13 16:15 applypatch-msg.sample
-rwxrwx--- 1 knorth ourproject 896 May 13 16:15 commit-msg.sample
-rwxrwx--- 1 knorth ourproject 189 May 13 16:15 post-update.sample
-rwxrwx--- 1 knorth ourproject 398 May 13 16:15 pre-applypatch.sample
-rwxrwx--- 1 knorth ourproject 1704 May 13 16:15 pre-commit.sample
-rwxrwx--- 1 knorth ourproject 1239 May 13 16:15 prepare-commit-msg.sample
-rwxrwx--- 1 knorth ourproject 4951 May 13 16:15 pre-rebase.sample
-rwxrwx--- 1 knorth ourproject 3611 May 13 16:15 update.sample
./info:
total 2
-rw-rw---- 1 knorth ourproject 240 May 13 16:15 exclude
./objects:
total 39
drwx--x--x 2 knorth grad 3 May 13 16:18 11
drwx--x--x 2 knorth grad 3 May 13 16:18 21
drwx--x--x 2 knorth grad 3 May 18 20:48 4b
drwx--x--x 2 knorth grad 3 May 18 20:48 65
drwx--x--x 2 knorth grad 3 May 18 20:48 69
drwx--x--x 2 knorth grad 3 May 18 20:48 7e
drwx--x--x 2 knorth grad 3 May 18 20:48 87
drwx--x--x 2 knorth grad 3 May 18 20:48 cd
drwx--x--x 2 knorth grad 3 May 18 20:48 d6
drwx--x--x 2 knorth grad 4 May 18 20:48 d9
drwx--x--x 2 knorth grad 3 May 13 16:18 e3
drwxrwx--- 2 knorth ourproject 2 May 13 16:15 info
drwxrwx--- 2 knorth ourproject 2 May 13 16:15 pack
./objects/11:
total 2
-r-------- 1 knorth grad 138 May 13 16:18 fb73c05ea22ab9c90a93795fb3f9c2797d0fea
./objects/21:
total 2
-r-------- 1 knorth grad 62 May 13 16:18 ed7bc969b55a4bf57da33c868ac3b61f94d75b
./objects/4b:
total 2
-r-------- 1 knorth grad 148 May 18 20:48 626af7d3bd4d8874899fca47498ccb40279dde
./objects/65:
total 2
-r-------- 1 knorth grad 125 May 18 20:48 82534615eb3f6b54114d8649cf68d8af15aa8b
./objects/69:
total 21
-r-------- 1 knorth grad 20518 May 18 20:48 4a8974a043e616448faa43bfe38a627738436a
./objects/7e:
total 3
-r-------- 1 knorth grad 1781 May 18 20:48 9e723b7b9f19170d93c4561592de6a9493cc6e
./objects/87:
total 2
-r-------- 1 knorth grad 61 May 18 20:48 27591210bd17c85f46f9fde043fe8cd25c11b0
./objects/cd:
total 2
-r-------- 1 knorth grad 153 May 18 20:48 327eec7c8f0a310a6da1283212679cc3baa229
./objects/d6:
total 2
-r-------- 1 knorth grad 63 May 18 20:48 a2be2b03ed954b5aa80349357e2b5a185122dd
./objects/d9:
total 94
-r-------- 1 knorth grad 93619 May 18 20:48 9733e331131b8bfccc817442bbd1959a8d37fb
-r-------- 1 knorth grad 387 May 18 20:48 c0db4b3d0309bea0370baeb9781994894fd16e
./objects/e3:
total 3
-r-------- 1 knorth grad 802 May 13 16:18 0616da1903944069de5b4d6d64c1ac0dead823
./objects/info:
total 0
./objects/pack:
total 0
./refs:
total 6
drwxrwx--- 2 knorth ourproject 3 May 18 20:48 heads
drwxrwx--- 2 knorth ourproject 2 May 13 16:15 tags
./refs/heads:
total 2
-rw------- 1 knorth grad 41 May 18 20:48 master
./refs/tags:
total 0
注意到大多數在objects
目錄中的文件現在有-r--------
權限和屬於到grad
組。這不是我期待的行爲,這意味着,只要我的合作者試圖從回購git pull
或git clone
,他們收到以下錯誤:
fatal: '/home/repo/location' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
如何配置Git倉庫或* nix的環境它存儲在使:
- 推的變化加入到倉庫被分配給文件
-rwxrwx---
權限和drwxrwx---
權限的文件夾,並 - 所有新文件添加到資料庫由普什所有新文件ng更改分配給
ourproject
組而不是grad
組?