http://help.github.com/win-git-installation/
http://help.github.com/msysgit-key-setup/
Git から自分のリモートレポジトリにアクセスするために必要な鍵を作成し、設定する。
ssh-keygen -t rsa -C "[email protected]"
%USERPROFILE% に .ssh というディレクトリが作成され、その中に 2 つの鍵が作成される。
cd /d %USERPROFILE%\.ssh
dir
id_rsa.pub が公開鍵。 id_rsa が秘密鍵。
https://github.com/account/ssh にて id_rsa.pub の内容を キー として追加する。
ssh [email protected]
最終的に、以下のように表示されれば成功。
ERROR: Hi 0mg! You've successfully authenticated, but GitHub does not provide shell access
Connection to github.com closed.
コミットする際に毎回使用する名前とメールアドレスを設定する。
git config --global user.name "0mg"
git config --global user.email "[email protected]"
- まず、 Web でリモートレポジトリ hoge.git を作成する。
- 次に、空のローカルレポジトリを作成し、
- ファイルを追加、
- コミット後、
- hoge.git の master へプッシュする。
md hoge
cd hoge
git init
touch README
git add README
git commit -m "first commit"
git remote add origin [email protected]:0mg/hoge.git
git push origin master
master 以外へもプッシュできる。まずはローカルブランチを作成しよう。
git branch new_branch
git checkout other_branch
git branch -d bad_branch
git branch
- ローカルブランチ new_branch ができたら、
- ファイルの追加とコミットを済ませ、
- 同じ名前のリモートブランチ new_branch を作成し、そこへプッシュしよう。
git push [email protected]:0mg/hoge.git new_branch
git push [email protected]:0mg/hoge.git :bad_branch
hoge.js を追加・更新する。
git add hoge.js
ディレクトリ内にある全てのサブディレクトリおよびファイルを追加・更新する。
git add .
git rm hoge.js
git clone git://github.com/0mg/hoge.git
git log
