LoginSignup
6
6

More than 5 years have passed since last update.

Gitbucketからcloneするときにアカウント・パスをきかれないように公開キーを設定する。

Last updated at Posted at 2015-09-17

1.SSH認証の公開鍵と秘密鍵を作成
2.Mac側のSSHキーの設定
3.Gitbucketへの公開鍵の登録

SSH認証の公開鍵と秘密鍵を作成

ssh-keygen -t rsa -f ~/.ssh/nini-no-id_rsa
chmod 600 ~/.ssh/nini-no-id_rsa

Mac側のSSHキーの設定

鍵の管理を簡単にするために設定 ~/.ssh/config

vi ~/.ssh/config
Host gitbucket
    HostName host_name.com
    IdentityFile ~/.ssh/nini-no-id_rsa
    User user_name
    Port xxxx

Gitbucketへの公開鍵の登録

ブラウザでGitbucketにアクセスして[account settings]>[SSH Keys]へ移動する

公開鍵をgitbucketに登録するためにファイルをクリップボードにコピー。

pbcopy < ~/.ssh/nini-no-id_rsa.pub

任意の
[Add an SSH Key]内のKeyに貼付け。
[Title]は適当に覚えやすいもの。
SSH-Keys.jpg
[Add]で登録。

SSH認証キーをBitbucket/GitHubに設定しよう! [Mac簡単手順]

cloneするとき

git clone ssh://[gitbucket]/user_name/repository.git dir_name

*[gitbucket]は~/.ssh/configで設定したもの
自分はしばーらく直接接続しようとしてしまっていたので・・
bitbucketにgitでpushするとPermission denied (publickey).と表示されるときの解決法

6
6
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
6
6