githubとか

ちょっとオンラインのあれこれを試す環境を作りたかったので、githubにアカウントを作ることにした。ってか、前にアカウントだけ作っていたけど、何もしていなかったので、もう少し整備した。
ただ、Redirecting...に書いてある通りにやってるだけだ。

gitのインストール

HomeBrewを使っているので、「brew install git」するだけ。簡単。たぶん、自分でbuildするのも簡単だろうと思うけれど。

% brew install git
Warning: Formula already installed: git
% where git
/usr/local/bin/git
% git --version
git version 1.7.6
% 

SSHの設定

MacOS XはOpenSSHがインストールされている。
SnowLeopardの場合、こんな感じ。

% ssh -v
OpenSSH_5.2p1, OpenSSL 0.9.8r 8 Feb 2011
usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
           [-D [bind_address:]port] [-e escape_char] [-F configfile]
           [-i identity_file] [-L [bind_address:]port:host:hostport]
           [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]
           [-R [bind_address:]port:host:hostport] [-S ctl_path]
           [-w local_tun[:remote_tun]] [user@]hostname [command]

Redirecting... に書いてあるように、ssh-key-gen して、自分のssh秘密鍵/公開鍵のペアを作っておく。で、id_rsa.pubの中身をgithubの “Account Settings”にある“SSH Public Keys”の“Add another public key”にペーストしておく。この時、空白とか改行とかがあるとうまくいかないようなので、コピペ時にはちょっとだけ注意しておく。

ここまでできたら、テスト。

% ssh -T git@github.com
Hi fukuit! You've successfully authenticated, but GitHub does not provide shell access.
% 

準備OKな感じ。

個人情報の登録

「個人情報=流出」な昨今だが、Redirecting...に基づき、登録する。その際に、“Account Settings”の“Account Admin.”から、API Tokenの文字列をコピーしておく。

% git config --global user.name "Firstname Familyname"
% git conifg --global user.email "Email address"
% git config --global github.user "github username"
% git config --global github.token token

以上で、ひととおりの登録は終了。次は、repositoryをgithubに作る。せっかくなので、以前に作ったアフォみたいなAndroidのソースとか卒研のRのコードとかを載せようかと思ったが、手元にあるヤツをimportする方法がまだよく分からんので、また、そのうちに。