LoginSignup
2
5

More than 5 years have passed since last update.

rails new した後のgit管理(GitHub Desktop使用)

Posted at

目的

新しくrails アプリケーションを作成する時、git管理をGitHubに加えて、ローカルリポジトリはGitHub Desktopでも管理したい。

手順

◾️アプリケーションの作成 (ターミナルで該当のディレクトリに移動後)
$ rails new sample _5.0.1_ -d mysql #アプリケーションを作成
$ cd sample #sampleディレクトリに移動
$ bundle exec rake db:create # データベースを作成

◾️GitHubにて右上の+マークのところでNew repositoryを作成

◾️新しいレポジトリを作成した後に出る表示(.. or create a new repository on the command line)の手順に従う。(該当のディレクトリにいることを確認してから)
$ git init
$ git add READE.md
$ git commit -m "first commit"
$ git remote add origin https://github.com/******/sample.git
$ git push -u origin master

これでGitHubの設定ができました。

◾️GitHub Desktopの設定

左上の+マークを押すしてAddを選んでください。
スクリーンショット 2018-11-08 22.14.51.png

そこでパソコン上にあるsampleフォルダを選択しましょう。

すると、rails newで作成したファイル等をコミットできるようになるので、masterにてコミット、プッシュしましょう。

以上でrails newからのGitHub、GitHub Desktopの設定になります。

2
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
5