SSH 사용하여 git clone하기
SSH 사용하여 git clone하기
clone repo using SSH key
자동화 Script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash
read -p "Enter your Git-Hub Email: " email
read -p "Enter secure algorithm (rsa or ed25519): " algo
# check directory
SSH_DIRECTORY=~/.ssh
if ! test -d "$SSH_DIRECTORY"; then
echo "Directory .ssh doesn not exist."
mkdir ~/.ssh
fi
# check Secure algorithm
if [[ "${algo}" == "rsa" ]] || [[ "${algo}" == "ed25519" ]]
then
ssh-keygen -t $algo -b 4096 -C "$email"
cd ~/.ssh
eval "$(ssh-agent -s)"
ssh-add id_${algo}
cat id_${algo}.pub | pbcopy
else
echo "Enter 'rsa' or 'ed25519' in algorithm"
fi
- pbcopy : 클립보트에 앞의 내용을 복사해준다.
이 기사는 저작권자의 CC BY 4.0 라이센스를 따릅니다.