์นดํ
๊ณ ๋ฆฌ ์์
git ๋ก๊ทธ์ธ ์์ด ์ฌ์ฉํ๊ธฐ
hanbindev
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