3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

/.ssh/config gitlab

Last updated at Posted at 2019-08-29

gitlabにsshのpublic keyの設定したあと,cloneしようとすると以下のようなエラーがでた

git@gitlab.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

私の場合(/.ssh/configにHost githubと書くのは間違い)で指摘されているように,ssh configの書き方が良くなかったようです.

~/.ssh/configを以下のように書き直すことで解決した

Host gitlab.com
    User git 
    IdentityFile ~/.ssh/id_rsa <-  your key path
    TCPKeepAlive yes
    IdentitiesOnly yes

おわり


おまけ

SSH Key作成コマンド

ssh-keygen -t rsa -C "hoge@example.com"

接続テスト

ssh -T git@gitlab.com  -i ~/.ssh/id_rsa
3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?