programing

git에서 꺼내는 동안 오류 발생 - 리포지토리 데이터베이스 .git/objects에 개체를 추가할 수 있는 권한이 부족합니다.

newnotes 2023. 9. 12. 20:42
반응형

git에서 꺼내는 동안 오류 발생 - 리포지토리 데이터베이스 .git/objects에 개체를 추가할 수 있는 권한이 부족합니다.

"git pull origin development"를 만들 때마다 git 오류가 발생합니다. "git/objects에 개체를 추가하기 위한 권한이 부족합니다."

    remote: Counting objects: 70, done.
    remote: Compressing objects: 100% (7/7), done.
    remote: Total 42 (delta 35), reused 42 (delta 35)
    error: insufficient permission for adding an object to repository database     .git/objects

    fatal: failed to write object
    fatal: unpack-objects failed

@ChrisHayes가 우연한 수단에 대해 옳다고 가정하면, 이는 해결될 것입니다.저장소 내부에서:

sudo chown -R $USER:$USER "$(git rev-parse --show-toplevel)/.git"

업데이트: 다음 정보를 받으시는 분들을 위해illegal group nameerror, 대신 시도해 보십시오.

sudo chown -R $(id -u):$(id -g) "$(git rev-parse --show-toplevel)/.git"

프로젝트의 루트 디렉터리로 이동하여 아래 명령을 실행하여 이 문제를 해결합니다.

cd .git/objects
sudo chown -R yourname:yourgroup *

제 실수는 바보같은 실수였어요올바른 사용자 이름과 그룹이 설정되었지만 www-data가 액세스 계정이었습니다.valuedil:www-data가 디렉토리를 소유하고 있었지만 권한이 755이므로 www-data가 디렉토리에 쓸 수 없습니다.다음 항목으로 수정:

$ sudo chmod -R 775 /path/to/repo

github에서 공용 저장소를 복제하려는 경우 URL에서 .git을 제거합니다.

예:

보낸 사람: https://github.com/example/repository.git 보낸 사람: https://github.com/example/repository

모범 사례가 아님(대안일 뿐)

저는 우분투를 사용하고 있는데 같은 문제에 직면했습니다.이를 해결하기 위해 단순히 사용자를 root로 전환했고 더 이상의 오류는 보이지 않습니다.

$su
password

그리고나서,

$git pull origin master

권장 방법: 디렉토리의 사용 권한 변경

언급URL : https://stackoverflow.com/questions/18779442/error-while-pull-from-git-insufficient-permission-for-adding-an-object-to-repo

반응형