获取/克隆 git 存储库的获取/拉取/只读副本的命令?

发布于 2024-08-20 16:36:39 字数 526 浏览 7 评论 0原文

这是 github 上的 git 存储库:

git://github.com/Fudge/gltail.git

使用 git 命令行工具查看只读副本的最简单方法是什么?

更新: 这是对 githubbers 的建议:做一些类似于 google code 的事情,它会自动显示一条消息,例如:

Use this command to anonymously check out the latest project source code:
    # Non-members may check out a read-only working copy anonymously over HTTP.
    svn checkout http://orapig.googlecode.com/svn/trunk/ orapig-read-only

更新: githubbers 已经这样做了。

Here's a git repository on github:

git://github.com/Fudge/gltail.git

What's the simplest way to check out a read-only copy using the git command line tool?

update: Here's a suggestion to the githubbers: Do something similar to google code, which automatically displays a message such as:

Use this command to anonymously check out the latest project source code:
    # Non-members may check out a read-only working copy anonymously over HTTP.
    svn checkout http://orapig.googlecode.com/svn/trunk/ orapig-read-only

update: The githubbers have done this.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

鸠魁 2024-08-27 16:36:39
git clone git://github.com/Fudge/gltail.git
git clone git://github.com/Fudge/gltail.git
不羁少年 2024-08-27 16:36:39

这个问题有点误导。实际上并不存在 git 存储库的“只读副本”这样的东西。您可以使用以下方式克隆现有存储库:

git clone git://example.com/path/to/repo.git

但与 Subversion 不同的是,git 中的每个“副本”本身就是一个全新的存储库。由于您可以提交到自己的存储库,因此从这个意义上来说它肯定不是只读的。

The question is a bit misleading. There's not really such a thing as a "read-only copy" of a git repository. You can clone an existing repository with:

git clone git://example.com/path/to/repo.git

But unlike Subversion, every "copy" in git is itself a completely new repository. Since you can commit to your own repository, it's certainly not read-only in that sense.

调妓 2024-08-27 16:36:39

我没有找到真正的“只读副本”,但您可以根据您的需要通过这种方式接近它:

1)git clone --深度1 git://github.com/Fudge/gltail。 git
说明:当您索取副本时,您可能对该副本的完整历史不感兴趣。
--depth 1 选项将下载限制为默认分支的最新版本,并且可能会显着减少要检索的数据量。

2) 如果您不想更新副本,可以删除副本根目录下的 .git 目录:它将切断与原始存储库的链接。

否则,如果您需要确保永远不会修改原始存储库,则必须通过您对此原始存储库的访问权限进行管理。

I didn't found a real "read-only copy", but you can approach it by this way depending on your need :

1) git clone --depth 1 git://github.com/Fudge/gltail.git
Explanation : as you ask for a copy, you may not be interested by the full history of that copy.
--depth 1 option limits the download to the last version of the default branch and may reduce dramatically the amount of data to retrieve.

2) If you don't want to update your copy, you can remove the .git directory at the root of your copy : it will cut the link with the original repository.

Otherwise, if your need is to be sure that you never modify the original repo, it must be managed by your access rights on this original repo.

日裸衫吸 2024-08-27 16:36:39

我以前必须这样做,其中“只读”副本是部署副本而不是开发副本。除了使用 --depth 1 之外,我们还使用了部署密钥 -- 但如果您不能这样做,那么您应该能够为此创建一个没有存储库写访问权限的用户,并阻止写访问权限具有 unix 权限的其他用户访问该用户的目录。对于需要快速解决方案的小团队来说,这是可行的。

I've had to do this before, where a "read only" copy was a deployment copy versus a development copy. In addition to using --depth 1, we used a deployment key --but if you can't do that then you should be able to create a user for this that doesn't have write access to the repo, and prevent write access to that user's directories by other users with unix permissions. For a small team that needs a quick solution, this can work.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文