windowsでgitをコンソールから使いたい場合の手順とsshの設定

windowsでgitをコンソールから使いたい場合の手順

gitを以下からダウンロードする
Git for Windows
f:id:yasuaki-ohama:20160204015738p:plain:w400
実行をクリック
f:id:yasuaki-ohama:20160204015825p:plain:w400
nextをクリック
f:id:yasuaki-ohama:20160204015905p:plain:w400
nextをクリック
f:id:yasuaki-ohama:20160204015933p:plain:w400
デフォルトの保存場所を利用
f:id:yasuaki-ohama:20160204015953p:plain:w400
デスクトップにアイコンを置きたいなら「On the Desktop」をチェックする
f:id:yasuaki-ohama:20160204020017p:plain:w400
nextをクリック
f:id:yasuaki-ohama:20160204020215p:plain:w400
環境変数pathに何を追加するかを選択
f:id:yasuaki-ohama:20160204021945p:plain:w400
改行設定(何もさせたくない場合は一番下)
f:id:yasuaki-ohama:20160204022301p:plain:w400
git bush以外でgitを使いたいなら真ん中を選択
f:id:yasuaki-ohama:20160204022712p:plain:w400
gitのキャッシュ機能を有効にしたい場合はチェックをつける
f:id:yasuaki-ohama:20160204022738p:plain:w400
完了
f:id:yasuaki-ohama:20160204023032p:plain:w400

sshで鍵の登録

Git Bashを起動する

$ cd ~/.ssh
$ ssh-keygen -t rsa -C "mail@example.com"
2,3設定を聞かれるので、全てEnterキーを押す
$ ls
id_rsa  id_rsa.pub

パーミッションの設定を行う
git bashだとchmodで変更できないので以下のサイトを参考に変更
Linux端末とWindowsコマンドプロンプト

$ chmod 600 id_rsa
$ chmod 600 id_rsa.pub

貼り付て登録

$ clip < ~/.ssh/id_rsa.pub

f:id:yasuaki-ohama:20160204023110p:plain:w400
通信テスト
最初の質問にyesと打ってEnterキーを押す

$ ssh -T git@github.com

適当にディレクトリ作成

$ mkdir test
$ cd test
$ touch README.md

Git Hubを使う

$ git init
$ git add README.md
$ git commit -m "first commit"
$ git remote add origin git@github.com:suakig/test.git
$ git push -u origin master

コピー&ペーストに関して

ConEmuでGit bashを使う

コンソールでコピーペーストが直接できる
ConEmu - Handy Windows Terminal
ダウンロードをクリック
f:id:yasuaki-ohama:20160204024427p:plain:w400
以下をクリック
f:id:yasuaki-ohama:20160204024431p:plain:w400
起動時の初期化をGit bashにする
f:id:yasuaki-ohama:20160204034016p:plain:w400
色を変える
f:id:yasuaki-ohama:20160204025613p:plain:w400

Git Bashでのコピー&ペースト