Git | GitLab

[GitLab] Mirroring repositories - LFS objects are missing 에러

비번변경 2022. 10. 23. 18:19

개요

GitLab 저장소 백업을 위해 GitLab의 Mirroing repositories 기능을 이용해 다른 GitLab 저장소로 Push하고 있는데, 아래와 같은 LFS objects are missing 에러 메세지와 함께 Push에 실패했다.

13:close stream to gitaly-ruby: rpc error: code = Unknown desc = Gitlab::Git::CommandError: remote: GitLab: LFS objects are missing. Ensure LFS is properly set up or try a manual "git lfs push --all". To http://gitlab.example/root/test.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'http://gitlab.example/root/test.git' .

에러 메세지

저장소를 확인해보니, LFS 객체가 포함되어 있었다.

LFS 객체

Gitlab Mirroing repositories 기능을 이용하는 게 아니라면 수동으로 해결할 수 있었을 것 같지만, 이번 일은 Mirroing repositories 기능을 이용해야했다. 확인해보니 미러링 저장소, 즉 백업 저장소에서 LFS를 비활성화하면 문제 없이 미러링이 가능했다.

 

 

GitLab 서버 LFS 비활성화 방법

기본적으로 GitLab 서버는 LFS를 활성화하고 있는데, 설정 파일을 수정 후 적용하면 이를 비활성화할 수 있다. 옴니버스 설치를 한 경우, 수정할 설정 파일은 /etc/gitlab/gitlab.rb 이다.

vi /etc/gitlab/gitlab.rb

# 생략
# Change to true to enable lfs - enabled by default if not defined
gitlab_rails['lfs_enabled'] = false

# Optionally, change the storage path location. Defaults to
# `#{gitlab_rails['shared_path']}/lfs-objects`. Which evaluates to
# `/var/opt/gitlab/gitlab-rails/shared/lfs-objects` by default.
gitlab_rails['lfs_storage_path'] = "/mnt/storage/lfs-objects"

설정 파일을 수정한 후에는 configure 명령을 사용해야 서비스가 재시작되면서 적용된다.

gitlab-ctl reconfigure

 

 

Gitlab 프로젝트 LFS 비활성화 방법

GitLab 서버 전체를 변경하는 게 부담스럽다면 해당 프로젝트만 비활성화하는 방법도 있다.

해당 프로젝트의 Settings > General로 이동한 후 Visibility, project features, permissions 항목을 펼친다.

Settings > General > Visibility, project features, permissions

항목에서 Git Large File Storage (LFS) 부분을 비활성화한다.

Git Large File Storage 비활성화

 

동작 확인

머러링 에러가 발생했던 저장소에서 다시 미러링을 시도하면 정상적으로 동작하는 것을 확인할 수 있다.

미러링 재시도
미러링 결과

 

 

문단 마지막 사용

https://docs.gitlab.com/ee/topics/git/lfs/

 

 

728x90