简体   繁体   中英

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. I first created the repo on the WWW GitHub, and initialized it with a readme. 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. So I tried 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. 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
# 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 . and it added everything without a hitch.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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