보통 gitlab 서버에서 레포지토리의 위치는

/var/opt/gitlab/git-data/repositories    아래에 프로젝트 아래에 위치해있다.

 

여기에서 

명령어를 사용해 레포지토리 목록을 파일로 받아오고 이어서

 

for문 을 돌려서 차례로 git clone을 실행한다.

 

 


ll /var/opt/gitlab/git-data/repositories/해당프로젝트 | grep -v '생략할 문자열' | cut -d" " -f9 > /home/user/list.txt

또는 

cd /var/opt/gitlab/git-data/repositories/해당프로젝트
ll | grep -v '생략할 문자열' | cut -d" " -f9 > /home/user/list.txt


목록 생성 뒤
powershell 기준 ps1 파일 스크립트


####################################################
# list.txt 파일의 내용을 읽어옵니다
$fileList = Get-Content -Path "./list.txt"

# 파일 목록을 반복하여 처리합니다
foreach ($fileName in $fileList) {
    # 파일 이름에 공백이나 특수 문자가 있을 수 있으니, 따옴표로 감쌉니다
    $fileName = $fileName.Trim()

    # 파일 이름이 디렉토리 또는 파일의 이름일 때 경로를 완성합니다
    $filePath = Join-Path -Path (Get-Location) -ChildPath $fileName
    
    git clone ssh://git@URL:포트/해당프로젝트/$fileName
   
}
####################################################

+ Recent posts