GitHubにアップロードしてみました。
https://github.com/ytyaru/ColorEditor20160609
https://github.com/ytyaru/ColorEditor20160610
https://github.com/ytyaru/ColorEditor20160614
流れ
環境はWindowsXPです。
とてつもなく大変でした。
- Git for Windows を用意する
- Git for Windowsをダウンロードする
- Git for Windowsをインストールする
- GitHubに登録する
- SSH環境を用意する
- SSH鍵を作成する
- GitHubにSSH公開鍵を登録する
(https://github.com/settings/ssh) C:\Documents and Settings\Administrator\.ssh/config
ファイルに以下を追記する
Host github.com.ytyaru
User git
Port 22
HostName github.com
IdentityFile ~/.ssh/[fileName]
TCPKeepAlive yes
IdentitiesOnly yes
- 接続テストする
GitBash > ssh -T github.com.ytyaru
- GitHubでリポジトリを作成する
- アップロードするソースコードを作成しておく
- 以下のバッチを実行する
:: GitHubアカウント
SET USER_NAME=ytyaru
SET USER_MAIL=xxxxx@yyyyy
:: "C:\Documents and Settings\Administrator\.ssh\config"ファイルの対象"HOST"
SET SSH_HOST=github.com.ytyaru
:: GitHubのリポジトリ名(アップロード先リポジトリ名)
SET REPOSITORY_NAME=ColorEditor20160610
:: ローカルリポジトリに.gitファイル一式を作成(リビジョン管理の開始)
git init
:: アカウント切替
git config --local user.name "%USER_NAME%"
git config --local user.email "%USER_MAIL%"
:: ローカルリポジトリにソースコードをステージングしコミットする
git add .
git commit -m "initial commit"
:: .git/configの設定追記コマンド。1回だけ実行すればいい。
:: 「fatal: remote origin already exists.」というエラーが表示されたらコメントアウトする。
git remote add origin git@%SSH_HOST%:%USER_NAME%/%REPOSITORY_NAME%.git
:: ローカルリポジトリからリモートリポジトリへ修正を反映させる
git push origin master
参考
http://dev.classmethod.jp/tool/github-ssh-sub-account-setting/
http://www.slideshare.net/nullpopopo/github-12293342
http://dackdive.hateblo.jp/entry/2015/10/12/210547