사용자 도구

사이트 도구


git:as_backup

문서의 이전 판입니다!


git as backup

  • git을 백업도구로 사용하기

특정 디렉토리 이하를 Git Repository로 백업할 때

  • SSH Key 를 생성해서 등록. github 이면 public key 를 Deploy Key로 등록.
  • private key 는 백업할 시스템 계정의 ~/.ssh/id_rsa 로 둔다. 그게 아니면 Linux SSH에서 ssh-agent로 등록해야한다.
  • 예를들어 /home/x/mydata 이하를 백업한다면, 해당 디렉토리 이하의 디렉토리나 파일들중 ignore할게 있다면 먼저 ignore할 파일, 디렉토리 바로 상위에 .gitignore를 만들어서 해당 파일/디렉토리를 기입해준다.
  • Git repository를 생성한다. 예, mydata리포지토리
# 미리 .gitignore 처리 필수
cd /home/x/mydata
git init
 
# 혹은 .gitattributes 에 * -text 항목 필요. 불필요한 줄끝형식 변환제거
git config core.autocrlf false
git config user.email "your@email.com"
git config user.name "Git AutoBackup"
git add .
git commit -m 'backup initialized'
git branch -M main
git remote add origin <https://githost.com/path-to-git-backup.git>
git push -u origin main

참조

git/as_backup.1599381208.txt.gz · 마지막으로 수정됨: 2020/09/06 17:33 저자 kwon37xi