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

GitBash起動時にsshを自動で登録する方法(備忘録)

Posted at

はじめに

WindowsでGitHubのSSH設定をした後、Git Bashを開いたときに自動でSSH鍵が登録されるようにしておく方法をよく忘れるので、備忘録として書き残しておこうと思いました。

SSHの登録・設定

いつもこちらの記事を参考にさせていただいています。

GitBash起動時に自動でSSHキーを登録する方法

GitBash上で作業します

1.bashrcを作成or編集

vim ~/.bashrc

2.次のスクリプトを末尾に追加

if [ -z "$SSH_AGENT_PID" ]; then
    eval $(ssh-agent -s)
    ssh-add ~/.ssh/rsa_github 2>/dev/null
fi

~/.ssh/rsa_githubの部分は実際使用している秘密鍵のファイル名に置き換えてください

3.設定を反映(再起動せずに反映したい場合)

source ~/.bashrc

以上で次回起動時からすぐにgit pushなどの操作ができます!

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