初めてのGitHub
.gitignoreの追記
スワップファイルなどの不要ファイルを.gitignoreに追記します。
# Ignore other unneeded files. doc/ *.swp *~ .project .DS_Store .idea .secret
Railsプロジェクトの追加とコミット
$ git config --global alias.co checkout $ git config --global core.editor vi $ git init Initialized empty Git repository in /<rails app path>/.git/ $ git add . $ git status # ステージングエリアのファイルを確認 $ git commit -m "Initialize repository" $ git log # コミットメッセージの履歴を参照
SSH作成とGitHubへの登録
「GitHub · Build software better, together.」でアカウントを作成しておきます。
「Generating SSH keys - User Documentation」の内容に沿ってSSHキーを作成します。
$ ssh-keygen -t rsa -C "<github email address>" # SSHキー生成 $ eval "$(ssh-agent -s)" # SSH Agentを起動 $ ssh-add ~/.ssh/id_rsa # SSH AgentにSSHキーを追加 $ cat ~/.ssh/id_rsa.pub # 公開キーをコピー # ---- GitHubサイトに公開キーを登録 ---- $ ssh -T git@github.com # 接続確認 Warning: Permanently added the RSA host key for IP address '<ip address>' to the list of known hosts. Enter passphrase for key '/<home directory>/.ssh/id_rsa': Hi <username>! You've successfully authenticated, but GitHub does not provide shell access.
ネット環境や時間帯の問題かもしれないですが、GitHubへのアクセスが重くて大変でした。
接続確認の手順も最初はハングしてしまったようで、やり直してみたら上手くいきました。