2012年4月27日金曜日

Githubで管理する〜プロジェクトを作る〜

まずはプロジェクトを作成しましょう!
$ rails new planets
次にruby1.8.7とruby1.9.3をrvmで分けて使用している場合に以下を設定すると便利
プロジェクト内で
$vi .rvmrc
次の1行を追加
rvm 1.9.3
一度プロジェクトディレクトリーの外へ移動してもう一度入り直すと

==============================================================================
= NOTICE                                                                     =
==============================================================================
= RVM has encountered a new or modified .rvmrc file in the current directory =
= This is a shell script and therefore may contain any shell commands.       =
=                                                                            =
= Examine the contents of this file carefully to be sure the contents are    =
= safe before trusting it! ( Choose v[iew] below to view the contents )      =
==============================================================================
Do you wish to trust this .rvmrc file? (/home/watarusato/seminer/test/planets/.rvmrc)
y[es], n[o], v[iew], c[ancel]>
と出てくるので「y」を選択
次にGithubの自分のアカウントに写り、「New Repository」をクリック
プロジェクト名
別に見えて問題ないのでpublicに設定(プライベートは有料らしい)
そしてRailsに設定して「Create Repository」をクリック
またプロジェクトへ戻ります。
$ git init
Initialized empty Git repository in /home/.../planets/.git/
これでプロジェクトに「.git」が追加されたのであとはプッシュするだけです。
$ git status
$ git add .
$ git commit -m 'first push'
$ git remote add origin git@github.com:アカウント名/プロジェクト名.git
$ git push -u origin master
Counting objects: 63, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (49/49), done.
Writing objects: 100% (63/63), 25.92 KiB, done.
Total 63 (delta 2), reused 0 (delta 0)
To git@github.com:アカウント名/プロジェクト名.git
 * [new branch] master -> master
となり、これで管理までは完了です。

0 件のコメント:

コメントを投稿