linux - 无法在现有 checkout 的 git 存储库中克隆 git repo

标签 linux git

我正在尝试将我的 git 存储库克隆到现有已 checkout 的 git 存储库中,但失败了。我以前做过这个工作流程,所以我不知道为什么现在会失败。有人有什么建议吗?

git 存储库确实存在,我可以在不同位置的 checkout 存储库之外克隆

假设我执行以下操作

1. cd <existing git repo clone folder>

2. git clone https://github.com/apache/cassandra
Cloning Git Repository of cassandra
Cloning into 'cassandra'...
fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.

什么可能导致此错误?

请注意 - 我不想将此存储库作为子模块添加到我的父 GIT 存储库中。我只是想弄清楚如何在从 git checkout 的现有工作文件夹中克隆存储库。

最佳答案

看看 git submodules 这正是为此而设计的。您可以在此处找到信息和示例:https://git-scm.com/book/en/v2/Git-Tools-Submodules

在您的情况下,这可能有效:

 git submodule add https://github.com/apache/cassandra

为了更改子模块以跟踪特定的提交更改目录到子模块文件夹并正常切换分支。

cd submodule
git checkout -b some_branch origin/some_branch

或者对于一些特定的标签

git checkout <version_tag>

您需要提交此更改才能更新。

关于linux - 无法在现有 checkout 的 git 存储库中克隆 git repo,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38400005/

相关文章:

linux - 无法以普通用户身份推送到 git 存储库

python - Git tree-filter 在提交时运行 python 脚本

git - "git submodule foreach"不适用于 Windows

linux - 如何从shell脚本文件中删除mongo数据库的文件

linux - 更新 glibc 后 : Segmentation fault (core dumped)

命令 "who -b"的行为不同

linux - 需要澄清十二要素应用程序声明中的第八要素和守护进程

Git:更改不应该留在他们的分支内吗?

linux - 从文件中取出某些数据

git - 如何使用 ssh 设置 tortoisegit 不需要密码