Linux-OracleCentos/Linux-OracleCentos__github

Github - 2. 연동

말하는감자 2022. 3. 1. 15:31

연동하기

ssh로 연동하기

  1. ssh key 생성
  • ssh-keygen -t rsa -b 4096 -C "--@gmail.com
[jungyin@dev-oracle-linux8 .ssh]$ ssh-keygen -t rsa -b 4096 -C "--@gmail.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/home/jungyin/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/jungyin/.ssh/id_rsa.
Your public key has been saved in /home/jungyin/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:J2DdTNLV1MPYjuT7IEydTS4/YOu1hObljcehUzgQhYY noelcoolblue@gmail.com
The keys randomart image is:
+---[RSA 4096]----+
|        ..o.++=. |
|       . E.+ o.=.|
|      o . + = B .|
|     . .   o O + |
|        S + o O  |
|         o o O O |
|            = @o=|
|             =.++|
|              .. |
+----[SHA256]-----+
[jungyin@dev-oracle-linux8 .ssh]$ ll
total 12
-rw-r--r--. 1 jungyin jungyin  577 Feb 26 14:13 authorized_keys
-rw-------. 1 jungyin jungyin 3389 Mar  1 06:14 id_rsa
-rw-r--r--. 1 jungyin jungyin  748 Mar  1 06:14 id_rsa.pub

  1. github에 키를 추가한다
  • id_rsa.pub의 내용을 복사후에
[jungyin@dev-oracle-linux8 .ssh]$ cat id_rsa.pub
ssh-rsa ...생략...
  • settings >> SSH and GPG keys >> New SSH key 에 붙여넣어준다


연동 후에 clone하기

  1. github의 repository 를 clone 한다
  • git clone 레파지토리주소
[jungyin@dev-oracle-linux8 workspaces]$ git clone git@github.com:noelcool/kokoatalk.clone.git
Cloning into 'kokoatalk.clone'...
The authenticity of host 'github.com (52.78.231.108)' can't be established.
ECDSA key fingerprint is SHA256:p2QAMXNIC1TJYWeIOttrVc98/R1BUFWu3/LiyKgUfQM.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'github.com,52.78.231.108' (ECDSA) to the list of known hosts.
remote: Enumerating objects: 211, done.
remote: Counting objects: 100% (211/211), done.
remote: Compressing objects: 100% (144/144), done.
remote: Total 211 (delta 112), reused 160 (delta 61), pack-reused 0
Receiving objects: 100% (211/211), 58.75 KiB | 0 bytes/s, done.
Resolving deltas: 100% (112/112), done.
Checking connectivity... done.
[jungyin@dev-oracle-linux8 workspaces]$ ll
total 0
drwxrwxr-x. 4 jungyin jungyin 190 Mar  1 06:21 kokoatalk.clone


오류 대응하기

  1. Permission denied
[jungyin@dev-oracle-linux8 workspaces]$ git clone git@github.com:noelcool/kokoatalk.clone.git
fatal: could not create work tree dir 'kokoatalk.clone': Permission denied
  • repository를 clone 하는 경로에 권한이 없는 경우에 발생한다
  • 해당 경로에 chmod, chown 등을 이용해서 권한 및 소유 설정을 해주어야 한다

  1. sudo: git: command not found
[jungyin@dev-oracle-linux8 workspaces]$ sudo git clone git@github.com:noelcool/kokoatalk.clone.git
sudo: git: command not found
  • git command에서는 sudo 사용이 불가능하므로 sudo 명령어를 제외하고 사용해야 한다

'Linux-OracleCentos > Linux-OracleCentos__github' 카테고리의 다른 글

Github - 1. 설치  (0) 2022.02.26