是否可以从远程位置克隆git配置? [英] Is it possible to clone git config from remote location?

查看:101
本文介绍了是否可以从远程位置克隆git配置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在远程位置有一个裸机回复,有一些配置我想分享给所有克隆它的人。可能吗?每次我克隆时,它似乎都将 .git / config 中的所有内容还原为默认值,并只添加有关远程回购的信息。

解决方案

我确认本地配置( .git / config 中的配置)绝不会在repo中共享

(出于各种安全原因,比如,例如:


  • 一个git别名,它将定义一些仅在特定环境中有效的命令

    (或 git命令自己 no ,如 Jan Hudec 的评论,并在问题是否可以通过git alias覆盖git命令?

  • 某些github指令( github.token )应该是秘密和错误地输入本地配置而不是全局配置

  • 个人配置,如 user.name 用户。电子邮件(如果这些信息与其他回购信息不同,可以在本地级别上设置):当其他克隆回购时,传播我的姓名和电子邮件无效。

  • ...
    )。



最接近的方法是使用其中的配置对实际文件进行版本化,并邀请用户将其复制到他们的 .git / config 文件


I have a bare repo on remote location with some configs I'd like to share with everyone who clones it. Is it possible? Every time I clone, it seems to revert everything in .git/config to defaults and just add information about remote repo.

解决方案

I confirm a local config (the one within .git/config) is never shared amongst repo
(for various security reasons, like, for instance,:

  • a git alias which would define some commands only valid in your particular environment
    (or git commands themselves: no, as Jan Hudec comments, and as detailed in the question "Is it possible to override git command by git alias?")
  • some github directive (github.token) supposed to be secret and incorrectly entered in the local config instead of the global one
  • personal config like user.name and user.email (which can be set on a local level if those differs from other repos): that wouldn't make sense to propagate my name and email when other clone my repo.
  • ... ).

The closest way to do that would be to version an actual file with the config in it, and invite users to copy it in their .git/config file

这篇关于是否可以从远程位置克隆git配置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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