티스토리 뷰
반응형
git 자동 push 쉘 스트립트 작성
작성된 sh파일은 cron 명령어를 통해 주기적 자동 배포가 가능함
1. ssh접근을 위해 리눅스 ssh key 생성
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ssh-keygen -t rsa -C "your Email" | |
# 엔터 3번 이상 칩니다. | |
$ cd /home/ubuntu/.ssh/ | |
$ cat id_rsa.pub |
2. ssh key를 생성 후 값을 복사해 Git > Settings > SSH and GPG keys > SSH keys > New SSH key > 추가 후 저장
3. 해당 레포지토리의 ssh주소를 git remote에 추가 (ex git@github.com:Git_Name/Repository.git)
git-sch.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#git-sch.sh | |
Y=$(date +%Y) | |
M=$(date +%m) | |
D=$(date +%d) | |
Ym="폴더이름" | |
Ymd="파일이름" | |
GitRep="로컬 레포지토리 경로" | |
HomeDir="로컬 Home 경로" | |
GitDir="$HomeDir/$GitRep" | |
FileDir="$HomeDir/$GitRep/$Ym" | |
FileNm="파일이름" | |
mkdir -p $FileDir | |
cd $GitDir | |
git add . | |
git commit -m "comment" | |
git push -u origin master | |
if [$? -eq 0 ];then | |
echo "> push complete" | |
fi |
** sh파일 내부 파일 경로에서 원하는 폴더 조작이 가능함
작성된 파일은 권한을 부여해서 사용할것 (chmod -x ./git-sch.sh)
반응형
'리눅스(Mint)' 카테고리의 다른 글
제작한 웹 페이지 포트 포워딩 하기 (0) | 2022.03.01 |
---|
반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- interview
- docker
- 디자인패턴
- springboot
- 그래프
- ajax
- 릿코드
- security
- kakao
- Matlab
- 수학
- Spring
- OOP
- CS
- C언어
- 백준
- 스프링
- 자격증
- Solid
- spring-cloud
- nginx
- 매트랩
- 면접
- JPA
- 스프링부트
- Algorithm
- 프로그래머스
- java
- 자바
- 알고리즘
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
글 보관함