サーバー建てたのでgit cloneしよっと
ssh: Could not resolve hostname <gitlabのアドレス>: Temporary failure in name resolution
fatal: Could not read from remote repository.
おや?
どうやら名前解決できてないっぽいぞ…?
IPを指定してもう一回
$ git clone <ipアドレスに変換したgitlabのssh>
Cloning into <gitlabのアドレス>...
<gitlabのアドレス>: Permission denied(publickey).
fatal: Could not read from remote repository
Please make sure you have the correct access rights
and the repository exists.
なんでや!
- やってること
- keyを作成
- gitlabに鍵を登録
- なんでpremission蹴られるのかわからない…
どうやら鍵がクライアント側に登録されてないようだ
ふむふむ。鍵が登録されているか確認して、登録する、と。
$ ssh-add -l
Could not open a connection to your authentication agent.
?
なるほど、ssh-agentが動いてないのね。
$ eval 'ssh-agent' // これはダメだった
$ eval "$(ssh-agent)"
Agent pid <ランダムのid>
もっかい確認。
$ ssh-add -l
The agent has no identities.
お。表記が変わった。登録されてないね。
$ ssh-add ~/.ssh/<鍵のファイル名>
Identity added:<鍵の場所>
登録された!
では、満を持して…
$ git clone <gitlabのssh>
ssh: Could not resolve hostname <gitlabのアドレス>: Temporary failure in name resolution
fatal: Could not read from remote repository.
あ、名前解決はされないのね。
$ git clone <ipアドレスに変換したgitlabのssh>
remote: Enumerating objects: 12527, done.
remote: Counting objects: 100% (50/50), done.
remote: Compressing objects: 100% (50/50), done.
remote: Total 12527 (delta 20), reused 0 (delta 0), pack-reused 12477
Receiving objects: 100% (12527/12527), 10.60 MiB | 31.28 MiB/s, done.
Resolving deltas: 100% (9415/9415), done.
YATTA!!
へへ、いったぜ…
今回初めてまっさらな状態でgit cloneしてみたので、sshのことがわかってないのもあり、sshについて理解を深めていきたいと思いました…
すごく初歩的なことで苦戦してたので、これからも研鑽していきます。
参考
参考にさせていただきました。ありがとうございます。