사전 실행
1에서 진행한 VM에서 (각 1대마다 진행)
# GitHub 로그인 → Settings → Emails
git config --global user.name "이름"
git config --global user.email "이메일"
# 각 VM에서 키 생성
ssh-keygen -t rsa -b 4096
# 공개키 확인
cat ~/.ssh/id_rsa.pub
# 이거 복사해서 GitHub → Settings → SSH Keys에 등록
<https://github.com/settings/ssh/new>
Title: 이름 아무거나 입력
Key Type: Authentication Key
Key: SSH 터미널에서 `cat ~/.ssh/id_rsa.pub` 결과 복사 붙여넣기.
SSH Keys 주소 : https://github.com/settings/ssh/new

결과 SSH Key는 위 사진처럼 출력됬다면 OK (처음 입력 시 , 핑거프린트 yes)
user1@ctrl:~$ ssh -T [[email protected]](<mailto:[email protected]>)
Hi Bakseongung! You've successfully authenticated, but GitHub does not provide shell access.
학습 목표
아래 템플릿을 참조해서 파일을 하나씩 넣어보기. (16:00)
단 아래와 같은 Git과 gh 만을 활용하여 작성하기.
Clover/
├── README.md
├── ansible/ # 박성웅
│ ├── inventory/
│ │ └── hosts.ini
│ ├── playbooks/
│ │ ├── site.yml
│ │ ├── docker.yml
│ │ ├── swarm.yml
│ │ └── monitoring.yml
│ └── roles/
│ ├── common/README.md
│ ├── docker/README.md
│ ├── swarm/README.md
│ └── monitoring/README.md
├── openstack/ # 김경훈
│ ├── kolla-ansible/README.md
│ └── network-config/README.md
├── docker/ # 조근희
│ ├── images/README.md
│ └── stacks/
│ ├── web.yml
│ └── monitoring.yml
├── backup/ # 박수근
│ └── scripts/
│ ├── backup.sh
│ ├── restore.sh
│ └── auto_recovery.sh
├── server/ # 이주희
│ ├── ssh-setup.sh
│ └── firewall.sh
└── docs/ # 공용(아무나)
├── architecture.md
└── troubleshooting/
├── openstack.md
├── swarm.md
└── ansible.md
Git,GH 설치 ~ PR 머지 총정리 (Ubuntu 24.04 VM)
*위 레포지토리 표는 다른 화면에 띄워서 , 투 컴퓨터 활용 권장
``` Git 전역 설정 ``` (예시, 건너 뛰어도됨)
git config --global user.name "Bakseongung"
git config --global user.email "[email protected]"
``` 2) 택1. GitHub 인증 (PAT) ```
GitHub → Settings → Developer settings → Personal access tokens → Generate new token → repo 체크
gh auth login
# → GitHub.com → HTTPS → Paste an authentication token → PAT 붙여넣기
``` 2) 택2. SSH Keys 인증 ```
위 사전 단계와 같음.
sudo apt update && sudo apt install -y git
# GitHub CLI
sudo apt install -y gh
# 확인
git --version
gh --version
```3. 레포 클론 ```
git clone <https://github.com/Bakseongung/ktcloud_Clover>
cd ktcloud_clover
```# 4. 템플릿 내용 확인
#템플릿 명령어가 잘 안 먹힐 수도 있음.
GPT를 사용해서 한글 내용을 확인할 수 있게끔 부탁드림.
어렵다면 5번으로 건너뛰기.
gh api repos/Bakseongung/ktcloud_Clover/contents/.github/pull_request_template.md \ --jq '.content' | base64 -d
gh api repos/Bakseongung/ktcloud_Clover/contents/.github/ISSUE_TEMPLATE/Clover.md \ --jq '.content' | base64 -d
# 5. 이슈 생성 & 번호 확인
gh api repos/Bakseongung/ktcloud_Clover/contents/.github/ISSUE_TEMPLATE/Clover.md \
--jq '.content' | base64 -d > issue_template.txt
gh issue create \ --title "feat: 프로젝트 생성" \ --body-file issue_template.txt \ --repo Bakseongung/ktcloud_Clover
gh issue list --repo Bakseongung/ktcloud_clover
6. 브랜치 생성
git checkout -b Clover/이슈번호-이름
Ex. checkout -b Clover/1-Bakseongung
다 만들지 말고, 본인이 해당한 부분만 작성. (코드 활용은 아래를 사용)
mkdir -p ansible/inventory ansible/playbooks ansible/roles/{common,docker,swarm,monitoring} mkdir -p openstack/{kolla-ansible,network-config} mkdir -p docker/images docker/stacks mkdir -p backup/scripts server docs/troubleshooting
touch ansible/inventory/hosts.ini touch ansible/playbooks/{site.yml,docker.yml,swarm.yml,monitoring.yml} touch ansible/roles/{common,docker,swarm,monitoring}/README.md touch openstack/{kolla-ansible,network-config}/README.md touch docker/images/README.md docker/stacks/{web.yml,monitoring.yml} touch backup/scripts/{backup.sh,restore.sh,auto_recovery.sh} touch server/{ssh-setup.sh,firewall.sh} touch docs/architecture.md docs/troubleshooting/{openstack.md,swarm.md,ansible.md}
git add . git commit -m "feat: 프로젝트 생성 (#1)" git push origin Clover/1-bakseongung
8. PR 생성
gh api repos/Bakseongung/ktcloud_Clover/contents/.github/pull_request_template.md \
--jq '.content' | base64 -d > pr_template.txt
sed -i 's/close #/close #1/' pr_template.txt
gh pr create \
--title "feat: 프로젝트 생성" \
--body-file pr_template.txt \
--base main \
--head Clover/1-bakseongung \
--repo Bakseongung/ktcloud_Clover
9. PR 머지
gh pr merge [pr번호] --squash --delete-branch --repo Bakseongung/ktcloud_Clover