문서의 선택한 두 판 사이의 차이를 보여줍니다.
양쪽 이전 판 이전 판 다음 판 | 이전 판 다음 판 양쪽 다음 판 | ||
git:as_backup [2020/09/06 16:33] kwon37xi [특정 디렉토리 이하를 Git Repository로 백업할 때] |
git:as_backup [2020/09/06 19:19] kwon37xi [주기적 백업을 수행할 shell script 생성] |
||
---|---|---|---|
줄 16: | 줄 16: | ||
git config user.email " | git config user.email " | ||
git config user.name "Git AutoBackup" | git config user.name "Git AutoBackup" | ||
+ | # 필요하면 | ||
+ | git config | ||
+ | |||
+ | # 파일 추가하고 커밋& | ||
git add . | git add . | ||
+ | git commit -m ' | ||
+ | git branch -M main | ||
+ | git remote add origin < | ||
+ | git push -u origin main | ||
+ | </ | ||
+ | ===== 주기적 백업을 수행할 shell script 생성 ===== | ||
+ | * '' | ||
+ | |||
+ | <code sh> | ||
+ | NOWT=$(date +" | ||
+ | cd / | ||
+ | git add . | ||
+ | git commit -m "$NOWT Automated git push" | ||
+ | git push | ||
</ | </ | ||
+ | * commit 할게 없어도 오류 없이 무시된다. | ||
+ | |||
+ | ===== cron 등록 ===== | ||
+ | * 매일 새벽 4시 5분에 실행. | ||
+ | <code sh> | ||
+ | 5 4 * * * / | ||
+ | </ | ||
+ | |||
+ | * 로그를 계속 남기려면 로그 파일 리다이렉트를 ''>>'' | ||
===== 참조 ===== | ===== 참조 ===== | ||
* [[https:// | * [[https:// | ||