c - 如何删除所有现有的 git 文件,以便我可以更新我自己的存储库而不会出现 fatal error ?

标签 c linux git version-control github

我有一个 C 项目的 git 克隆,上面有我自己的自定义模块,在最后修改之后,我想制作我自己的稳定存储库作为 github 的备份。所以当我尝试添加如下时,​​它失败了,因为在子目录中有很多 .git 或 .gitignore 存在:

例子:

$ ls -a
/var/tmp/me  << main project
/var/tmp/me/folder/main.c
/var/tmp/me/folder/main.h
/var/tmp/me/folder/etcetc.c
/var/tmp/me/folder/.gitignore
/var/tmp/me/folder/.git
/var/tmp/me/another/.git
/var/tmp/me/another/.gitignore
$ sudo git remote add origin git@github.com:me/my.git
fatal: Not a git repository (or any of the parent directories): .git

如何删除所有 以前的 git 存储库标志?以便我可以应用 git remote add origin?

最佳答案

我觉得你可以试试

git submodule add git@github.com:me/submodule.git

关于c - 如何删除所有现有的 git 文件,以便我可以更新我自己的存储库而不会出现 fatal error ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8459863/

相关文章:

c - 警告 : assignment from incompatible pointer type [enabled by default]

c - 从头开始用 C 语言编程 ARM

c - "Processes.GetProcessesByName("PROCESSNAME")"的 C 版本是什么?

linux - 像 KVM 这样的虚拟机管理程序是否需要在 CPUID 上退出 VM?

git - 发布分支的 Azure devops merge 类型

c - 打印文件上的硬链接(hard link)

c - 用于在 Linux 中创建库的 Makefile 无法编译

linux - 错误 : NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver

git - 这么多未使用的分支。如何清理?

linux - 如何在提交前从 git add 中删除某种类型的文件和目录?