Cygwinのインストール
ここでは、gnupackというアーカイブ展開のみでcygwinとemacsを使えるツールを利用することにします。ダウンロードして、展開するだけでcygwinとemacsがすぐに使えます。以下のサイトからダウンロードします。
Gitのインストール
cygwinを起動し、gitをインストールします。gnupackでは、cygwinパッケージをインストールする際にコマンドラインから実行するためのスクリプトがあるので、それを利用します。以下のコマンドを打つ。
cyg-pm install git
これでgitのインストールは終わりです。試しに「git」とコマンドを打ちます。正常にインストールされていれば以下のように表示されるはずです。
# git
usage: git [--version] [--exec-path[=<path>]] [--html-path]
[-p|--paginate|--no-pager] [--no-replace-objects]
[--bare] [--git-dir=<path>] [--work-tree=<path>]
[-c name=value] [--help]
<command> [<args>]
The most commonly used git commands are:
add Add file contents to the index
bisect Find by binary search the change that introduced a bug
branch List, create, or delete branches
checkout Checkout a branch or paths to the working tree
clone Clone a repository into a new directory
commit Record changes to the repository
diff Show changes between commits, commit and working tree, etc
fetch Download objects and refs from another repository
grep Print lines matching a pattern
init Create an empty git repository or reinitialize an existing one
log Show commit logs
merge Join two or more development histories together
mv Move or rename a file, a directory, or a symlink
pull Fetch from and merge with another repository or a local branch
push Update remote refs along with associated objects
rebase Forward-port local commits to the updated upstream head
reset Reset current HEAD to the specified state
rm Remove files from the working tree and from the index
show Show various types of objects
status Show the working tree status
tag Create, list, delete or verify a tag object signed with GPG
See 'git help <command>' for more information on a specific command.
ユーザ情報の設定
gitでユーザ情報の設定を行います。以下のコマンドでユーザ名とメールアドレスを設定します。
git config --global user.name "ユーザ名"
git config --global user.email "メールアドレス"
SSHの鍵の作成
コマンドで鍵ファイルの作成を行います。
ssh-keygen -b 2048 -t rsa -f ~/.ssh/github_rsa
この後、.sshフォルダ内に「github_rsa.pub」と「github_rsa」が生成されていることを確認します。
公開鍵の登録
上で生成した、公開鍵「github_rsa.pub」をGithubへ登録します。
Githubでログインし、 「Account Settings」→「SSH Public Keys」→「Add another public key」の「Key」に、github_rsa.pubの中身をコピーして貼り付けます。(「Title」は適当でOK)
SSH設定ファイルの作成
.sshフォルダ内に「config」というファイルを生成します。configファイル内に以下の内容を記述します。
Host github.com
User git
Port 22
Hostname github.com
IdentityFile ~/.ssh/github_rsa
TCPKeepAlive yes
IdentitiesOnly yes
これで、OK。
参考サイト
以下のサイトを参考にさせていただきました。