标记远程 git 存储库而不克隆它 [英] Tag a remote git repository without cloning it

查看:18
本文介绍了标记远程 git 存储库而不克隆它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法标记远程 git 存储库而无需在本地克隆它?

Is there a way to tag a remote git repository without having cloned it locally?

为了将代码存储库与配置存储库相关联,我想(作为 CI 构建步骤)用 build-n 标记配置存储库的当前头(其中 N 是 jenkins 提供的当前内部版本号).

In order to correlate a code repository with a config repository, I want to (as a CI build step) tag whatever is the current head of the config repository with build-n (where N is the current build number provided by jenkins).

配置存储库不用作构建的一部分,我只是想要一种简单的方法来获取配置修订,就像构建版本 1234 时一样,并将其标记为build-1234"似乎实现这一目标的最简单方法.

The config repository isn't used as part of the build, I simply want an easy way to fetch the config revision as it was when for example version 1234 was built, and tagging it as "build-1234" seems like the simplest way to achieve this.

推荐答案

作为答案:目前无法使用 git 进行远程标记,但是如果您可以通过某种方式访问​​远程 (裸) 存储库,您可以标记远程位置.

To have this as an answer: there is at the moment no way to do remote tagging with git, but if you have access in some way to the remote (bare) repository, you may be able to tag on the remote location.

例如,如果你通过SSH访问git仓库,你可以使用SSH登录,进入(裸)仓库并执行标签命令(git tag build-1234 master)(裸)存储库.

For example, if you access the git repository via SSH, you can login using SSH, go to the (bare) repository and execute the tag command (git tag build-1234 master) in the (bare) repository.

(我不完全确定@ruslan-kabalin 提到的工具)

(I am not completely sure about the tool mentioned by @ruslan-kabalin)

这篇关于标记远程 git 存储库而不克隆它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆