简体   繁体   English

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

[英]git add -A . not adding multiple directories and files

I am trying to add a couple new directories, and files to a github repo that I created on the WWW GitHub. 我正在尝试将一些新目录和文件添加到我在WWW GitHub上创建的github仓库中。 I first created the repo on the WWW GitHub, and initialized it with a readme. 我首先在WWW GitHub上创建了repo,并用自述文件初始化它。 Then I cloned it to my local box, and added a bunch of files, and directories and files in the directories. 然后我将它克隆到我的本地盒子中,并在目录中添加了一堆文件,目录和文件。

When I did a git add ./* which worked before, did not recognize anything in the directory, and said nothing changed. 当我做了一个git add ./*以前工作过,在目录中没有识别任何内容,并且没有任何改变。 So I tried git add -A . 所以我尝试了git add -A . and same thing. 同样的事情。 Then I used git add * and it added just ONE directory with the files in that, but it is not adding the other directories. 然后我使用了git add *并且它只添加了一个目录中的文件,但它没有添加其他目录。 The directory structure is: 目录结构是:

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

The git status shows this: 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)
#

How do I get around this? 我该如何解决这个问题?

I figured out, you don't want to name the immediate sub-directory the same as your repository root. 我想,您不希望将直接子目录命名为与存储库根目录相同。 then it will work perfectly. 然后它将完美地工作。 Instead of zabbix_config_manager and having a folder directly under it named the same, I used zabbix-config-manager and I was able to use git add . 我使用zabbix-config-manager而不是zabbix_config_manager并且直接在其下面的文件夹命名相同,我能够使用git add . and it added everything without a hitch. 它毫无障碍地添加了所有内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM