ㅁㄴㅇㄻㄴㅇㄹ

git 로그인 없이 사용하기 본문

카테고리 없음

git 로그인 없이 사용하기

hanbin8269 2022. 5. 24. 02:17

💡 pull, push 할때마다 로그인하기 번거롭기 때문에, ssh agent를 설정해두자

ssh key 생성

ssh-keygen -t rsa -b 4096 -C "본인 gitlab email"
# id_rsa 이름 설정 (id_gitlab)
# 이후로 뭐라 나오는데 무시하고 엔터

ssh agent 활성화

eval "$(ssh-agent -s)"

ssh agent에 ssh key 등록

ssh-add ~/.ssh/id_gitlab

remote branch ssh 프로토콜로 지정

# 기존 remote 삭제
git remote rm origin

# ssh 프로토콜 origin 생성
git remote add origin ssh://git@git.elicer.io:2201/elice/backend/elice-api.git

Gitlab에 ssh key 등록

cat ~/.ssh/id_gitlab
# 결과 값 복사

위에서 복사한 결과 값 붙여넣기 후 Add Key

gitlab ssh keys setting