相关疑难解决方法(0)

从远程Git存储库中检索特定提交

有没有办法只从远程Git仓库检索一个特定的提交而不在我的PC上克隆它?远程仓库的结构与我的结构完全相同,因此不会有任何冲突,但我不知道如何做到这一点,我不想克隆那个庞大的存储库.

我是git的新手,有什么办法吗?

git git-fetch

178
推荐指数
6
解决办法
34万
查看次数

如何浅拉按分支名称跟踪的子模块

您好,我有一个包含子模块的超级项目。子模块通过分支名称而不是 sha 提交号进行跟踪。在我们的构建服务器上,我想尽可能少地拉动。所以我尝试了

git submodule update --remote --init 
Run Code Online (Sandbox Code Playgroud)

然而这并不肤浅。似乎拉出所有内容然后切换到分支

git submodule update --remote --init --depth 1
Run Code Online (Sandbox Code Playgroud)

这不起作用,它失败了:

git submodule update --remote --init --depth 1 ThirdParty/protobuf
Submodule 'ThirdParty/protobuf' (ssh://myrepo/thirdparty/protobuf.git) 
registered for path 'ThirdParty/protobuf'
Cloning into '/home/martin/jenkins/workspace/test_log_service/repo/ThirdParty/protobuf'...
fatal: Needed a single revision
Unable to find current origin/version/3.2.0-era revision in submodule path 'ThirdParty/protobuf'
Run Code Online (Sandbox Code Playgroud)

关于浅层子模块有一个不同的问题,但是我不认为它适用于分支,仅适用于 sha 提交

git git-submodules

5
推荐指数
1
解决办法
2895
查看次数

在特定提交处获取 git repo,无需克隆

我正在尝试在不克隆的情况下获取特定提交哈希的 git 存储库!每个示例都想克隆整个存储库。这是有道理的,但我想要的存储库很大,我需要它留下一个小的足迹,因为它与 Docker 镜像一起使用。

提交哈希在 URL 中 - 或者wget可以curl/应该递归获取,但我有一种感觉 github 正在阻止它,因为我得到的只是robots.txt

回购和提交:

https://github.com/phalcon/cphalcon/tree/1d6d21c98026b5de79ba5e75a3930ce7d1ebcd2e

我最好的尝试错误:

git fetch https://github.com/phalcon/cphalcon/ 1d6d21c98026b5de79ba5e75a3930ce7d1ebcd2e
error: Server does not allow request for unadvertised object 1d6d21c98026b5de79ba5e75a3930ce7d1ebcd2e
Run Code Online (Sandbox Code Playgroud)

更新

使用克隆的答案建议并不能回答问题。我可以克隆/结帐没有问题。尝试在本地没有整个存储库的情况下执行此操作

git github git-fetch git-remote

3
推荐指数
1
解决办法
3203
查看次数

标签 统计

git ×3

git-fetch ×2

git-remote ×1

git-submodules ×1

github ×1