Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Git删除供应商中的文件_Git - Fatal编程技术网

Git删除供应商中的文件

Git删除供应商中的文件,git,Git,我需要在git中跟踪供应商目录中的文件。我知道这并不常见,但我必须将所有内容作为一个包交付到一个孤立的网络。这是客户的要求。无论如何,我已经卖了16个依赖项。有十四个工作和我预期的完全一样。两个依赖关系将不再存在。这不是.gitignore的结果。我已经从依赖项中删除了.git目录。我使用的是git版本2.1.2。但git仍然不会将这些文件添加到repo中。有什么建议吗?我已经解决了这些问题。首先,我运行了以下代码: for X in `find /projects/go/src/c2s/ven

我需要在git中跟踪供应商目录中的文件。我知道这并不常见,但我必须将所有内容作为一个包交付到一个孤立的网络。这是客户的要求。无论如何,我已经卖了16个依赖项。有十四个工作和我预期的完全一样。两个依赖关系将不再存在。这不是.gitignore的结果。我已经从依赖项中删除了.git目录。我使用的是git版本2.1.2。但git仍然不会将这些文件添加到repo中。有什么建议吗?

我已经解决了这些问题。首先,我运行了以下代码:

for X in `find /projects/go/src/c2s/vendor -type f`
do
    git add --force $X
done
这对两个问题儿童中的一个有效。第二种方法产生了以下错误:

fatal: Pathspec '/projects/go/src/c2s/vendor/github.com/Shopify/sarama/.travis.yml' is in submodule 'vendor/github.com/Shopify/sarama'
fatal: Pathspec '/projects/go/src/c2s/vendor/github.com/Shopify/sarama/CHANGELOG.md' is in submodule 'vendor/github.com/Shopify/sarama'
...
...
fatal: Pathspec '/projects/go/src/c2s/vendor/github.com/Shopify/sarama/LICENSE' is in submodule 'vendor/github.com/Shopify/sarama'
fatal: Pathspec '/projects/go/src/c2s/vendor/github.com/Shopify/sarama/Makefile' is in submodule 'vendor/github.com/Shopify/sarama'
我发现它给出了以下方向:

Delete the section referring to the submodule from the .gitmodules file
Stage the changes via git add .gitmodules
Delete the relevant section of the submodule from .git/config.
Run git rm --cached path_to_submodule (no trailing slash)
Run rm -rf .git/modules/path_to_submodule
Commit the changes with ```git commit -m "Removed submodule "
Delete the now untracked submodule files rm -rf path_to_submodule
然后我再次运行上面的脚本,一切都卡住了