1
0

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.

Gitサービスをssh鍵で利用する[決定版]

Last updated at Posted at 2019-04-22

鍵の作り方毎回忘れるので覚えているうちに書き残します。

鍵生成

コマンドは、以下の感じで使えばいいと思います。
ssh-keygen -o -t rsa -C"[name]@mail.com" -f"[name]_rsa"

.ssh/configに登録

Host sample-gitlab
  User git
  HostName gitlab.com
  identityFile ~/.ssh/[name]_rsa

登録されたものがちゃんと動くかテスト
ssh -T [host name]

Gitサービスに登録

pubキーをクリップボードにコピー

pbcopy < ~/.ssh/[name]_rsa.pub
clip < ~/.ssh/[name]_rsa.pub

remote add

~/.ssh/configで書いたHost名をgit@の後に入れてremoteを登録する

git remote add origin git@[host name]:[user name]/[repository name].git

ひとこと

Happy Hacking!

1
0
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?