質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Cloud9

Cloud9は、クラウドからのプログラミングが可能になるWebサービス。IDEとしての機能が搭載されており、GitHubやHerokuなど他ツールとの連携も可能です。ブラウザ上で動くため、デバイスに関係なく開発環境を準備できます。

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Q&A

解決済

2回答

1442閲覧

git initでセットアップするには

y_tantan

総合スコア19

Cloud9

Cloud9は、クラウドからのプログラミングが可能になるWebサービス。IDEとしての機能が搭載されており、GitHubやHerokuなど他ツールとの連携も可能です。ブラウザ上で動くため、デバイスに関係なく開発環境を準備できます。

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

0グッド

0クリップ

投稿2019/08/21 12:05

こんばんは。度々質問しております。

railsチュートリアルでgit statusを入力したところ以下のように表示されてしまいます。
おそらく git initも、git add-Aもできていないと思うのですが
どこがいけないのでしょうか?

On branch master No commits yet Changes to be committed: (use "git rm --cached <file>..." to unstage) new file: .c9/.nakignore new file: .c9/metadata/environment/hello_app/Gemfile new file: .c9/metadata/environment/hello_app/app/controllers/application_controller.rb new file: .c9/metadata/environment/hello_app/config.ru new file: .c9/metadata/environment/hello_app/config/application.rb new file: .c9/metadata/environment/hello_app/config/environment.rb new file: .c9/metadata/environment/hello_app/config/environments/development.rb new file: .c9/metadata/environment/hello_app/config/environments/test.rb new file: .c9/metadata/environment/hello_app/config/initializers/assets.rb new file: .c9/metadata/environment/hello_app/config/routes.rb new file: .c9/metadata/preview-https:/c5529be23d334596987a2f92e2b1becc.vfs.cloud9.us-east-2.amazonaws.com new file: .c9/metadata/tab0 new file: .c9/metadata/tab1 new file: .c9/metadata/tab2 new file: .c9/out_of_memory new file: .c9/project.settings new file: README.md new file: hello_app/.gitignore new file: hello_app/Gemfile new file: hello_app/Gemfile.lock new file: hello_app/README.md new file: hello_app/Rakefile new file: hello_app/app/assets/config/manifest.js new file: hello_app/app/assets/images/.keep new file: hello_app/app/assets/javascripts/application.js new file: hello_app/app/assets/javascripts/cable.js new file: hello_app/app/assets/javascripts/channels/.keep new file: hello_app/app/assets/stylesheets/application.css new file: hello_app/app/channels/application_cable/channel.rb new file: hello_app/app/channels/application_cable/connection.rb new file: hello_app/app/controllers/application_controller.rb new file: hello_app/app/controllers/concerns/.keep new file: hello_app/app/helpers/application_helper.rb new file: hello_app/app/jobs/application_job.rb new file: hello_app/app/mailers/application_mailer.rb new file: hello_app/app/models/application_record.rb new file: hello_app/app/models/concerns/.keep new file: hello_app/app/views/layouts/application.html.erb new file: hello_app/app/views/layouts/mailer.html.erb new file: hello_app/app/views/layouts/mailer.text.erb new file: hello_app/bin/bundle new file: hello_app/bin/rails new file: hello_app/bin/rake new file: hello_app/bin/setup new file: hello_app/bin/spring new file: hello_app/bin/update new file: hello_app/bin/yarn new file: hello_app/config.ru new file: hello_app/config/application.rb new file: hello_app/config/boot.rb new file: hello_app/config/cable.yml new file: hello_app/config/database.yml new file: hello_app/config/environment.rb new file: hello_app/config/environments/development.rb new file: hello_app/config/environments/production.rb new file: hello_app/config/environments/test.rb new file: hello_app/config/initializers/application_controller_renderer.rb new file: hello_app/config/initializers/assets.rb new file: hello_app/config/initializers/backtrace_silencers.rb new file: hello_app/config/initializers/cookies_serializer.rb new file: hello_app/config/initializers/filter_parameter_logging.rb new file: hello_app/config/initializers/inflections.rb new file: hello_app/config/initializers/mime_types.rb new file: hello_app/config/initializers/wrap_parameters.rb new file: hello_app/config/locales/en.yml new file: hello_app/config/puma.rb new file: hello_app/config/routes.rb new file: hello_app/config/secrets.yml new file: hello_app/config/spring.rb new file: hello_app/db/seeds.rb new file: hello_app/lib/assets/.keep new file: hello_app/lib/tasks/.keep new file: hello_app/log/.keep new file: hello_app/package.json new file: hello_app/public/404.html new file: hello_app/public/422.html new file: hello_app/public/500.html new file: hello_app/public/apple-touch-icon-precomposed.png new file: hello_app/public/apple-touch-icon.png new file: hello_app/public/favicon.ico new file: hello_app/public/robots.txt new file: hello_app/test/application_system_test_case.rb new file: hello_app/test/controllers/.keep new file: hello_app/test/fixtures/.keep new file: hello_app/test/fixtures/files/.keep new file: hello_app/test/helpers/.keep new file: hello_app/test/integration/.keep new file: hello_app/test/mailers/.keep new file: hello_app/test/models/.keep new file: hello_app/test/system/.keep new file: hello_app/test/test_helper.rb new file: hello_app/tmp/.keep new file: hello_app/vendor/.keep Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: .c9/metadata/tab0

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答2

0

そりゃ、git initしてないからじゃないですか?

投稿2019/08/21 12:13

y_waiwai

総合スコア87749

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

y_tantan

2019/08/21 13:22

git initすると Reinitialized existing Git repository in /home/ec2-user/environment/.git/ と表示されるのですが、 どこが不十分かわかりません。。。
y_waiwai

2019/08/21 13:27

/home/ec2-user/environment のディレクトリにリポジトリが作られているってことですが、 あなたが想定している作業ディレクトリはここなんでしょうか
y_tantan

2019/08/21 13:32

チュートリアルだと Initialized empty Git repository in /home/ec2-user/environment/environment/hello_app/.git/ となっているので合わせたいです。
y_waiwai

2019/08/21 13:35

なら、 cd /home/ec2-user/environment/environment/hello_app として、そのディレクトリに移動してから、 git init しましょう
y_tantan

2019/08/21 13:53

cd /home/ec2-user/environment/environment/hello_app 入力したら bash: cd: /home/ec2-user/environment/environment/hello_app: No such file or directory と出てきました。。。 home/ec2-user/environment/hello_appは表示されるのですが git initすると On branch master No commits yet Untracked files: (use "git add <file>..." to include in what will be committed) .gitignore Gemfile Gemfile.lock README.md Rakefile app/ bin/ config.ru config/ db/ lib/ log/ package.json public/ test/ tmp/ vendor/ nothing added to commit but untracked files present (use "git add" to track) と帰ってきてしまいました。
y_waiwai

2019/08/21 13:58

そのディレクトリが存在しないなら、作ればいいという話になりますが、 そのrailsチュートリアルが想定しているディレクトリはホンマにそこなんでしょうか
y_tantan

2019/08/21 14:15

推奨環境であるクラウドIDE (1.2.1) にはデフォルトでGitが導入されていますので、追加で導入する必要はありません。 ・ ・ ・ git configで設定 インストールしたGitを使う前に、最初に1回だけ設定を行う必要があります。これはsystemセットアップと呼ばれ、コンピュータ1台につき1回だけ行います。 $ git config --global user.name "Your Name" $ git config --global user.email your.email@example.com このgit configで設定する名前やメールアドレスは、今後リポジトリ上で一般に公開されますのでご注意ください git initでセットアップ 今度は、リポジトリ (リポ (repo) と略されることもあります) ごとに作成の必要な作業を行います。まず、Railsアプリケーションのルートディレクトリに移動し、新しいリポジトリの初期化を行います。 $ git init Initialized empty Git repository in /home/ec2-user/environment/environment/hello_app/.git/ 次にgit add -Aを実行し、プロジェクトのファイルをリポジトリに追加します。 というように続いています。 「Railsアプリケーションのルートディレクトリ」というのがいまいち良く分かりません汗
y_waiwai

2019/08/21 14:19

ふむー、、 その、railsチュートリアルってのを知ってる人にご登場願わないといけないようですね。
winterboum

2019/08/21 21:00

Railsアプリケーションのルートディレクトリ とは rails new hoge ってしたときにできる *****/hoge ディレクトリのことです。 Gemfile のある所。
guest

0

ベストアンサー

git status でそのlistがでるということは、git init はされています。
> Changes to be committed:
とあると言うことは
git init し、 git add したが、git commit がまだされていない、ということを知らせています
git init していない時はエラーになり、
fatal: Not a git repository (or any of the parent directories): .git
と出ます。

ただ、この git init はやるべきdir の一つ上でやっているように見えます。
new file: hello_app/Gemfile
ってありますが、hello_app dirが管理すべきエリアでは?

もしそうでしたら、git 管理を止めて hello_app でgit init し直す
もしこのままで良いなら git commit する。
git 管理を止めるには rm -rf .git

/home/ec2-user/environment/environment/hello_app
でなく
/home/ec2-user/environment/hello_app
でよいかと

投稿2019/08/21 14:13

winterboum

総合スコア23329

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

y_tantan

2019/08/21 14:19

/home/ec2-user/environment/hello_appでgit initすると On branch master No commits yet Untracked files: (use "git add <file>..." to include in what will be committed) .gitignore Gemfile Gemfile.lock README.md Rakefile app/ bin/ config.ru config/ db/ lib/ log/ package.json public/ test/ tmp/ vendor/ nothing added to commit but untracked files present (use "git add" to track)  というように返ってきてしまいます。
winterboum

2019/08/21 14:25

ですから、その一つ上で git init しているんで、そこはすでにgit配下であるためにそうなってます。一つ上で rm -rf .git
y_tantan

2019/08/21 14:38

ec2-user:~/environment (master) $ rm -rf .git ec2-user:~/environment $ git init Initialized empty Git repository in /home/ec2-user/environment/.git/ これで良いのでしょうか?!
winterboum

2019/08/21 14:40 編集

あ〜〜〜やり直しです。 ec2-user:~/environment (master) $ rm -rf .git のあと、 cd hello_app して git init です
y_tantan

2019/08/21 14:50

ec2-user:~/environment/hello_app (master) $ rm -rf .git ec2-user:~/environment/hello_app $ git init Initialized empty Git repository in /home/ec2-user/environment/hello_app/.git/ ec2-user:~/environment/hello_app (master) $ git add -A ここまで問題ないように思えたのですが ec2-user:~/environment/hello_app (master) $ git status On branch master No commits yet Changes to be committed: (use "git rm --cached <file>..." to unstage) new file: .gitignore new file: Gemfile new file: Gemfile.lock new file: README.md new file: Rakefile new file: app/assets/config/manifest.js new file: app/assets/images/.keep new file: app/assets/javascripts/application.js new file: app/assets/javascripts/cable.js new file: app/assets/javascripts/channels/.keep new file: app/assets/stylesheets/application.css new file: app/channels/application_cable/channel.rb new file: app/channels/application_cable/connection.rb new file: app/controllers/application_controller.rb new file: app/controllers/concerns/.keep new file: app/helpers/application_helper.rb new file: app/jobs/application_job.rb new file: app/mailers/application_mailer.rb new file: app/models/application_record.rb new file: app/models/concerns/.keep new file: app/views/layouts/application.html.erb new file: app/views/layouts/mailer.html.erb new file: app/views/layouts/mailer.text.erb new file: bin/bundle new file: bin/rails new file: bin/rake new file: bin/setup new file: bin/spring new file: bin/update new file: bin/yarn new file: config.ru new file: config/application.rb new file: config/boot.rb new file: config/cable.yml new file: config/database.yml new file: config/environment.rb new file: config/environments/development.rb new file: config/environments/production.rb new file: config/environments/test.rb new file: config/initializers/application_controller_renderer.rb new file: config/initializers/assets.rb new file: config/initializers/backtrace_silencers.rb new file: config/initializers/cookies_serializer.rb new file: config/initializers/filter_parameter_logging.rb new file: config/initializers/inflections.rb new file: config/initializers/mime_types.rb new file: config/initializers/wrap_parameters.rb new file: config/locales/en.yml new file: config/puma.rb new file: config/routes.rb new file: config/secrets.yml new file: config/spring.rb new file: db/seeds.rb new file: lib/assets/.keep new file: lib/tasks/.keep new file: log/.keep new file: package.json new file: public/404.html new file: public/422.html new file: public/500.html new file: public/apple-touch-icon-precomposed.png new file: public/apple-touch-icon.png new file: public/favicon.ico new file: public/robots.txt new file: test/application_system_test_case.rb new file: test/controllers/.keep new file: test/fixtures/.keep new file: test/fixtures/files/.keep new file: test/helpers/.keep new file: test/integration/.keep new file: test/mailers/.keep new file: test/models/.keep new file: test/system/.keep new file: test/test_helper.rb new file: tmp/.keep new file: vendor/.keep どうしてもno commits yet と出てしまいます、、、
winterboum

2019/08/21 14:54 編集

そこで git commit して下さい git add はgitへの登録の準備だけで、それをcommitして登録されます
y_tantan

2019/08/22 15:06

なんとかできました! 最後までお付き合いいただきありがとうございました。 またご指導いただくことがあるかと思いますが、その際はまたよろしくお願い致します。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問