git add -A。不添加多个目录和文件

时间:2013-08-30 15:30:00

标签: git chef

我正在尝试将一些新目录和文件添加到我在WWW GitHub上创建的github存储库中。我首先在WWW GitHub上创建了repo,并用自述文件初始化它。然后我将它克隆到我的本地盒子中,并在目录中添加了一堆文件,目录和文件。

当我做了之前工作的git add ./*时,在目录中没有识别任何内容,并且没有任何改变。所以我尝试git add -A .同样的事情。然后我使用git add *并且它只添加了一个目录,其中包含了文件,但它没有添加其他目录。目录结构是:

zabbix_config_manager
|
| - roles
|| - role_1.rb
|| - role_2.rb
|
| - zabbix_config_manager
|| - attributes
||| - default.rb
||
|| - recipes
||| - default.rb
||| - recipe_1.rb

git status显示了这一点:

$ git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       new file:   roles/role_asp_zabbix_agent.rb
#       new file:   roles/role_corp_server_ceszabbixcrt01.rb
#       new file:   roles/role_corp_server_ceszabbixcrt02.rb
#       new file:   roles/role_corp_server_grdzabbixprd01.rb
#       new file:   roles/role_corp_zabbix_agent.rb
#       new file:   roles/role_corp_zabbix_javagateway.rb
#       new file:   roles/role_corp_zabbix_proxy.rb
#       new file:   roles/role_corp_zabbix_server.rb
#
# 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)
#   (commit or discard the untracked or modified content in submodules)
#
#       modified:   zabbix_config_manager (modified content)
#

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:2)

我发现,您不希望将直接子目录命名为与存储库根目录相同。然后它将完美地工作。我使用zabbix_config_manager而不是zabbix-config-manager并且直接在其下面的文件夹命名相同,我使用git add .并且它添加了所有内容而没有任何障碍。