해결방법 1.
Repair Permissions
After you have identified and fixed the underlying cause (see below), you'll want to repair the permissions:
cd /path/to/repo.git sudo chgrp -R groupname . sudo chmod -R g+rwX . find . -type d -exec chmod g+s '{}' +
Note if you want everyone to be able to modify the repository, you don't need the chgrp and you will want to change the chmod to sudo chmod -R a+rwX .
If you do not fix the underlying cause, the error will keep coming back and you'll have to keep re-running the above commands over and over again.
Underlying Causes
The error could be caused by one of the following:
-
The repository isn't configured to be a shared repository (see core.sharedRepository in git help config). If the output of:
git config core.sharedRepositoryis not group or true or 1 or some mask, try running:
git config core.sharedRepository groupand then re-run the recursive chmod and chgrp (see "Repair Permissions" above).
-
The operating system doesn't interpret a setgid bit on directories as "all new files and subdirectories should inherit the group owner".
When core.sharedRepository is true or group, Git relies on a feature of GNU operating systems (e.g., every Linux distribution) to ensure that newly created subdirectories are owned by the correct group (the group that all of the repository's users are in). This feature is documented in the GNU coreutils documentation:
... [If] a directory's set-group-ID bit is set, newly created subfiles inherit the same group as the directory, and newly created subdirectories inherit the set-group-ID bit of the parent directory. ... [This mechanism lets] users share files more easily, by lessening the need to use chmod or chown to share new files.
해결방법 2.
난 이게 더 심플한거 같기도.
For Ubuntu (or any Linux)
From project root,
cd .git/objects
ls -al
sudo chown -R yourname:yourgroup *
You can tell what yourname and yourgroup should be by looking at the permissions on the majority of the output from that ls -al command
Note: remember the star at the end of the sudo line
'서버 등 운영체제(OS) > Linux' 카테고리의 다른 글
How to setup apache server for React route? (0) | 2020.05.26 |
---|---|
How to gitlab restart (0) | 2020.02.06 |
[Ubuntu] socat 을 사용한 포트 포워딩 Port forwarding (0) | 2017.11.27 |
history 명령 재 실행 (0) | 2016.09.06 |
SSL 웹서버 시작시 암호 입력 안하기 (0) | 2016.08.01 |