Jenkins - GitHub 연동하기
GitHub 에서 token 생성 (Settings > Developer settings > Personal access tokens > Generate new token)
Scopes는 repo, admin:repo_hook 선택
생성된 token은 나중에 확인할 수 없으므로 따로 저장해두기!
Jenkins GitHub Servers 설정 (Jenkins 관리 > 시스템 설정 > GitHub)
- 아래와 같이 설정 후 "Test connection" 클릭 후 verified 되면 성공
+ Manage hooks 선택
Add Credentials
- Kind: Secrete Text
- Secret: 생성한 GitHub token
- ID: 저장할 Credential 이름
Jenkins Job 추가 (Freestyle project > 소스 코드 관리 > Git 선택)
Repository URL 입력
remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
Add Credentials
- Kind: Username with password
- Password: 생성한 GitHub token
(token이 아닌 비밀번호는 사용 불가능함 / remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.)
- ID: 저장할 Credential 이름
저장 후 빌드가 성공하면 {Jenkins root path}/{JobName}/workspace 아래에 Git Project가 pull 된다.