What one likes, one will do well.

ブログ名は日本語で「好きこそものの上手なれ」、でも俺滑舌悪いから「すきこそももも」って言っちゃう///

GitHubの設定手順メモ

f:id:takamk2:20130626001516j:plain

こんばんわ。缶酎ハイを飲むと吐き気がします。
気持ち悪いです。
ビールならいくらでもいけます。

今回は、gitの設定とGitHubの設定を自分用にメモしておきますん。
ちなみにOSはCentOSです。

うぇ~気持ち悪いwww

まずはgitのインストーーーール

$ sudo yum install git

gitの設定

ユーザ情報

$ git config --global user.name "<ユーザ名>"
$ git config --global user.email "<メールアドレス>"

gitのカラーリング

$ git config --global color.ui auto

これで色付きになる

ちなみに設定はホームディレクトリの.gitconfigにこんな感じで保存される。

$ vi ~/.gitconfig
[user]
    name = <ユーザ名>
    email = <メールアドレス>
[color]
    ui = auto

GitHubに登録する

  • [sign up]をクリック
  • username、email、passwordを入力
  • [Create an account]をクリック

…出来ましたぜ。おやびん!

GitHubにpushするためにsshの鍵を生成する

$ cd
$ ssh-keygen
~/.sshに鍵が作成された

githubディレクトリを作成し、そこに秘密鍵と公開鍵を置く。

$ .ssh
$ mkdir github
$ mv id_rsa id_rsa.pub

パーミッションを変更する

$ cd ~/.ssh
$ chmod 600 config
$ cd github
$ chmod 600 id_rsa.pub

ssh接続時に秘密鍵を使うための設定を.ssh/configに書き込む

Host github.com
Hostname github.com
Identityfile ~/.ssh/github/id_rsa

GitHubの設定を行う。

  • AccountSettingsを押して設定ページに飛ぶ
  • SSH Keysタブを選択
  • [Add SSH Key]ボタンを押す
  • Titleに「ssh public key」と入力
  • Keyに ~/.ssh/github/id_rsa.pub の中身をコピペする
  • [Add key]ボタンを押す

リポジトリを作成する

  • [New repository]ボタンをクリック
  • Repository name、Descriptionを入力
  • Publicを選択
  • [Create repository]ボタンを押す

リポジトリにpushする

$ cd
$ mkdir study
$ cd study
$ touch README.md
$ git init
$ git add .
$ git commit -m "first commit"
$ git remote add origin git@github.com:takamk2/study.git
$ git push -u origin master

とりあえず、一通りできた…のかな?

今回はここまでにしておこう。そのうち基本的な使い方メモでも書こうかしら。

ん~、LPICの勉強に重点置きはじめてから最近パーフェクトPHP読んでないなぁ。
このパターンで積むことが多いから気をつけなきゃ!

ほげー('∀`)