为什么Git会在计算机上提交我所拥有的一切?

时间:2012-10-31 17:28:08

标签: ruby-on-rails git

使用Michael Hartl的Ruby on Rails指令,我在命令行中输入以下内容:

$ git init
$ git add .
$ git status

我得到的输出没有意义。看起来我的计算机上的所有内容都已提交,即我的网络浏览历史记录。

# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage) 
#
#   modified:   .DS_Store
#   new file:   .Trash/.DS_Store
#   modified:   .bash_history
#   modified:   .gem/specs/rubygems.org%80/latest_specs.4.8
#   new file:   .gem/specs/rubygems.org%80/quick/Marshal.4.8/treetop-1.4.12.gemspec
#   new file:   .gem/specs/rubygems.org%80/quick/Marshal.4.8/tzinfo-0.3.34.gemspec 
#   modified:   .gem/specs/rubygems.org%80/specs.4.8
#   modified:   Desktop/.DS_Store
#   modified:   Library/Application Support/AddressBook/Metadata/.info
#   modified:   Library/Application Support/AddressBook/Sources/7A5B88B6-2E8C-44D5-B3C5-96C523D66818/Metadata/.info
#   modified:   Library/Application Support/CrashReporter/Intervals_31838DA3-3634-5B48-BAA4-074D9844D0AB.plist
#   modified:   Library/Application Support/Dock/FD847662-EDEA-43DC-8969-18D1DD48507E.db
#   modified:   Library/Application Support/Sublime Text 2/Settings/Auto Save Session.sublime_session
#   modified:   Library/Application Support/Ubiquity/peer-0773FD5E-421F-A363-E209-F9D5E42A0F5F-v23/item-info.db
#   new file:   Library/Caches/Metadata/Safari/Bookmarks/2AD8D7AF-5B59-4BF5-9C80-749756908961.webbookmark
#   modified:   Library/Caches/Metadata/Safari/History/.tracked filenames.plist
#   new file:   Library/Caches/Metadata/Safari/History/Safari history item-282.webhistory
#   new file:   Library/Caches/Metadata/Safari/History/Safari history item-283.webhistory
#   new file:   Library/Caches/Metadata/Safari/History/Safari history item-284.webhistory
#   new file:   Library/Caches/Metadata/Safari/History/Safari history item-285.webhistory
#   new file:   Library/Caches/Metadata/Safari/History/Safari history item-286.webhistory
#   new file:   Library/Caches/Metadata/Safari/History/Safari history item-287.webhistory
#   new file:   Library/Caches/Metadata/Safari/History/Safari history item-288.webhistory
#   new file:   Library/Caches/Metadata/Safari/History/Safari history item-289.webhistory
#   new file:   Library/Caches/Metadata/Safari/History/Safari history item-290.webhistory
#   new file:   Library/Caches/Metadata/Safari/History/Safari history item-291.webhistory
#   new file:   Library/Caches/Metadata/Safari/History/Safari history item-292.webhistory
#   new file:   Library/Caches/Metadata/Safari/History/Safari history item-293.webhistory
#   new file:   Library/Caches/Metadata/Safari/History/Safari history item-294.webhistory
#   new file:   Library/Caches/Metadata/Safari/History/Safari history item-295.webhistory

在尝试提交之前,我在另一个终端中运行$ rails server并得到以下输出:

=> Booting WEBrick
=> Rails 3.2.8 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2012-10-31 12:30:26] INFO  WEBrick 1.3.1
[2012-10-31 12:30:26] INFO  ruby 1.9.3 (2012-10-12) [x86_64-darwin12.2.0]
[2012-10-31 12:30:26] INFO  WEBrick::HTTPServer#start: pid=3773 port=3000


Started GET "/assets/rails.png" for 127.0.0.1 at 2012-10-31 12:52:53 -0400
Connecting to database specified by database.yml
Served asset /rails.png - 200 OK (3ms)

从上一个问题开始,我知道$ rails server将继续运行,直到我关闭终端窗口。请帮忙!为什么我的计算机上的所有内容,包括Web历史都被提交给Git?

1 个答案:

答案 0 :(得分:8)

因为您在homefolder中运行了该命令。您需要使用cd /path/to/your/code来确保您位于代码文件夹中。使用pwd查看您当前所在的目录。