선행 조건
- Jenkins 설치 완료 및 기본 플러그인 설치
- Jenkins가 설치 되어 있는 서버에 git, maven 설치
Github 홈페이지 -> Github Signed(오른쪽 상단) -> Settings -> Developer settings
Personal access tokens -> Token(classic) -> Generate new token
Jenkins관리 -> 시스템 설정
Add Github Server
Name 작성 후 Add 클릭
Kind : Secret text 선택
Secret : 위에 발급 받은 토큰 붙여넣기
ID : 생성할 Credential 이름
Test connection
Jenkins -> 새로운 Item
소스 코드 관리 -> Git 선택
<img src="https://velog.velcdn.com/images/tjdtn0219/post/d82dfc9b-dae1-4d78-aefd-36a226f5e3af/image.png"
Kind: Username with password 선택
Username: Github의 username
Password: 위에서 생성한 token키 값
ID: 생성할 Credential 이름(임의로 적으면 됨)
이후 저장을 하게 되면 Item이 생성하는데 Build now를 누르고 Consolue Output에 Build Success라고 뜨면
다음 그림과 같이 Jenkins 사용자 디렉토리 아래의 workspace에 git에서 받은 프로젝트가 생성되어 있을 것이다.