会社PCからGithubであれこれやる環境を整えたメモ

会社環境からGithubにあれこれやるための環境を整えた時のメモ。

  • Windows7 Enterprise 64bit
  • 社内Proxyあり
  • 参考にした方 先輩という名の人柱

Githubアカウントを作る。(省略)

Github for WindowsをこちらGitHub Desktop | Simple collaboration from your desktopから入手、インストール。


msysgitをこちらGoogle Code Archive - Long-term storage for Google Code Project Hosting.から入手、インストール。


SSH keypairを作りGithubへ登録。

Windowsスタートメニュー -> Git -> Git Bash」から

$ ssh-keygen -t rsa -C "自分のメールアドレス"

「C:\Users/hogehoge/.ssh」配下に諸々の鍵が生成。GithubSSH Keysページhttps://github.com/settings/sshからpublic key(id_rsa.pub)を登録。

接続テスト…だが…

$ ssh git@github.com

…失敗。ですよねー。(たぶんProxy経由でなければここで成功する、と思う)

proxy超えをするための設定

「C:\Users/hogehoge/.ssh」配下にconfigを作成。以下を記述する。
先に補足すると

    • connect.exeは【C:\Program Files\Git\bin】の配下にあるので気にしない。
    • ★proxy.example.com:port★は各々の環境に合わせて書き換える。

ProxyCommand connect.exe -H ★proxy.example.com:port★ %h %p

Host github.com
User git
Port 22
Hostname github.com
IdentityFile "C:\Document and Settings\username\\.ssh\id_rsa"
TCPKeepAlive yes
IdentitiesOnly yes

Host ssh.github.com
User git
Port 443
Hostname ssh.github.com
IdentityFile "C:\Document and Settings\username\\.ssh\id_rsa"
TCPKeepAlive yes
IdentitiesOnly yes

以下ページを参考に頑張る。
GitHubにプロキシ経由でpushする(Windows環境) - wadahiroの日記
Windowsで社内LANからプロキシを超えてGitHubにSSH接続する方法 | REFLECTDESIGN
懶人日記: ssh over proxyでgithubをアクセスする(Windows)

接続テスト〜そして成功へ

$ ssh git@github.com

Warning: Permanently added '[ssh.github.com]:443' (RSA) to the list of known hosts.
Hi ★★★(名前ね)! You've successfully authenticated, but GitHub does not provide shell access.
Connection to ssh.github.com closed.

成功するはず。お疲れ様でした。