git提交期间发生git修改内容错误 更新-1

git提交期间发生git修改内容错误 更新-1,git,commit,Git,Commit,这就是我想做的 cd /tmp git clone http://git.example.com/foo/openstack.git -b ansible-roles ansible-roles-new cd ansible-roles-new cp -r /etc/ansible/roles /tmp/ansible-roles-new 在那之后,我做了git commit-m“foo…”并运行了git status,但它显示了修改的内容不知道为什么,不让我git推送:( 这是我在新文件夹中

这就是我想做的

cd /tmp
git clone http://git.example.com/foo/openstack.git -b ansible-roles ansible-roles-new
cd ansible-roles-new
cp -r /etc/ansible/roles /tmp/ansible-roles-new
在那之后,我做了
git commit-m“foo…”
并运行了
git status
,但它显示了
修改的内容
不知道为什么,不让我
git推送
:(

这是我在新文件夹中的目录结构

[root@foo ansible-roles-new]# ls -l /tmp/ansible-roles-new/roles/
total 196
drwxr-xr-x 16 root root 4096 Jun 24 22:43 ansible-hardening
drwxr-xr-x 12 root root 4096 Jun 24 22:43 apt_package_pinning
drwxr-xr-x  9 root root  203 Jun 24 22:45 bird
drwxr-xr-x 13 root root 4096 Jun 24 22:45 os_cinder
drwxr-xr-x 15 root root 4096 Jun 24 22:43 ceph_client
drwxr-xr-x 11 root root 4096 Jun 24 22:43 config_template
drwxr-xr-x 10 root root  219 Jun 24 22:45 etcd
drwxr-xr-x 14 root root 4096 Jun 24 22:43 galera_client
drwxr-xr-x 15 root root 4096 Jun 24 22:43 galera_server
...
...
...
many more...
这是非常奇怪的事情

[root@foo ansible-roles-new]# git status
# On branch ansible-roles
# 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:   roles/os_cinder (modified content)
#   modified:   roles/os_keystone (modified content)
#   modified:   roles/os_magnum (modified content)
#   modified:   roles/os_octavia (modified content)
#   modified:   roles/rabbitmq_server (modified content)
#   modified:   roles/rsyslog_client (modified content)
#
no changes added to commit (use "git add" and/or "git commit -a")
git初始化了吗

[root@foo ansible-roles-new]# git init
 Reinitialized existing Git repository in /tmp/ansible-roles-new/.git/
但它没有再次创建.git目录,看起来它也不再跟踪该目录了

我遗漏了什么吗

运行
git-1.8.x

编辑: 如果我修改了
角色/os_cinder
目录中的任何内容,它将不再跟踪并检测不到任何更改

git diff
说它很脏但不知道在哪里

@@ -1 +1 @@
-Subproject commit ff5207066cfef8eb380c35d398a884d357e2738d
+Subproject commit ff5207066cfef8eb380c35d398a884d357e2738d-dirty
diff --git a/ansible-roles-new/roles/os_cinder b/etc-ansible/roles/os_cinder
--- a/ansible-roles-new/roles/os_cinder
+++ b/ansible-roles-new/roles/os_cinder
@@ -1 +1 @@

这就是我发现的。当我从public
github.com
repo签出ansible/roles时,它已经有了一些
.git
ancher。后来,当我试图移动内部git服务器中导致上述问题的同一文件夹时

清理完所有
.git
后,它会工作

for qw in `ls /etc/ansible/roles`; do  rm -rf /etc/ansible/roles/$qw/.git*; done

这就是我发现的。当我从public
github.com
repo签出ansible/roles时,它已经有了一些
.git
ancher。后来,当我试图移动内部git服务器中导致上述问题的同一文件夹时

清理完所有
.git
后,它会工作

for qw in `ls /etc/ansible/roles`; do  rm -rf /etc/ansible/roles/$qw/.git*; done

我甚至不知道问题是什么。你在一个文件夹中执行了
git status
,删除了另一个文件夹中的
.git
文件夹,然后又在第一个文件夹中执行了
git init
。你没有解释问题是什么以及你希望用这些命令实现什么。你为什么要执行它们问题出在哪里?在你看到我正在更改文件夹的地方,我总是在
/tmp/ansible roles new/
目录中,在该目录中我有
角色
dir
/tmp/ansible roles new/roles/
但你做了
rm-rf roles/os\u cinder/.git
,那不是
.git
状态为
.git
文件夹将在第一个示例中使用。第一个示例中的
.git
文件夹必须位于当前文件夹或文件夹层次结构的更高位置,而不是位于您在第二段代码中删除文件夹的层次结构的更深位置。从上一次输出可以明显看出,
.git
文件夹位于
ansible roles new
文件夹中呃,但是你删除了另一个文件夹。令人困惑的是我仍然不知道你为什么会有问题。你说“这是非常奇怪的事情”。你能解释一下奇怪的东西是什么吗?为什么你要问一个问题,问题是什么?你已经将这些设置为子模块,其中你有一个顶级存储库,它几乎没有内容,只是作为跟踪每个子模块的哈希ID的地方。每个子模块都是一个普通的Git存储库。你在superproject跟踪每个子模块Git存储库中要使用的提交哈希。我甚至不确定问题是什么。您在一个文件夹中执行了
Git status
,删除了另一个文件夹中的
.Git
文件夹,然后在第一个文件夹中再次执行了
Git init
。您没有解释什么问题是以及您希望用这些命令完成什么。为什么要执行它们?问题是什么?当您看到我正在更改文件夹时,我总是在
/tmp/ansible roles new/
目录中,在该目录中我有
角色
dir
/tmp/ansible roles new/roles/
,但您做了
rm-rf roles/os_cinder/.git
,这不是第一个示例中将使用的
git status
文件夹。第一个示例中的
.git
文件夹必须位于当前文件夹或文件夹层次结构的更高位置,而不是位于删除第二段代码中文件夹的层次结构的更深位置。显而易见从上一次输出来看,
.git
文件夹位于
ansible roles new
文件夹中,但您删除了另一个文件夹。令人困惑的是,我仍然不知道您为什么会遇到问题。您说“这是非常奇怪的事情”。你能解释一下奇怪的东西是什么吗?为什么你要问一个问题,问题是什么?你已经将这些设置为子模块,其中你有一个顶级存储库,它几乎没有内容,只是作为跟踪每个子模块的哈希ID的地方。每个子模块都是一个普通的Git存储库。你在超级项目跟踪每个子模块Git存储库中要使用的提交哈希。