検索条件
全1件
(1/1ページ)
なんか突如としてGitHubにHTTP経由で繋ぐのが面倒くさくなったのでSSHで繋げるようにしたときのメモ。
github.secとするここではWindowsのSSHクライアントを利用する。
git config --global core.sshCommand "C:/Windows/System32/OpenSSH/ssh.exe"
C:/Users/<ユーザー名>/.ssh/に置くC:/Users/<ユーザー名>/.ssh/configを開き、次の内容を記述
Host github.com
User <ユーザーID>
Hostname github.com
IdentityFile C:/Users/<ユーザー名>/.ssh/github.sec
パス表現に%USERPROFILE%は通用しないので注意~/.ssh/github.secに置くchmod 600 ~/.ssh/github.secとかして自分しか見れないようにする~/.ssh/configを開き、次の内容を記述
Host github.com
User <ユーザーID>
Hostname github.com
IdentityFile ~/.ssh/github.sec
ここではoriginがリモートであるとして進める。
git remote -vでリモートリポジトリの状況を確認git remote remove originでHTTP通信になってるのを消すgit remote add origin git@github.com:Hoge/piyo.gitでSSH通信に書き換えるgit fetchが通ればOK