我可以在回购中指定.git / config的值 [英] Can I specify .git/config values in a repo

查看:110
本文介绍了我可以在回购中指定.git / config的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个需要许多非典型设置的git repo。我想设置它,以便人们克隆我的回购和分支机构时,他们不必按照步骤列表。但我也不想处理与他们合作的其他回购协议,甚至可能在同一个项目中。



我想要



$ ul
  • git config remote。< remote> .push HEAD:/ refs / for / something li>
  • git config branch。< branch> .merge refs / head / something (其中分支的远程是<远程>



  • 有没有一些方法来配置这个,以便通过克隆回购一切设置正确吗?

    解决方案

    没有。这是故意的。你的回购是你的。您完全可以控制其中的内容,直到您明确采取行动才会发生任何事情。



    为了帮助其他人正确设置您的项目,最简单的方法可能是提供〜repo / config setup〜脚本可以运行或不运行它。



    另一件你可以做的事情,虽然它看起来有点问题这里需要的是在你的网站上用你建议的配置设置默认的回购模板。这样,您网站上的用户将默认获得您想要的设置。任何知道自己拥有默认设置的人在运行repo setup脚本时都不会有任何问题。



    关于尽我所能让设置变得毫无意义的是,提供一个自定义模板,可能通过一个简单的前端(例如,完整的内容 git clone --template = path / to / yourproject / template$ @)。


    I have a git repo that requires a number of atypical settings. I'd like to set it up so that when people clone my repo and work with branches they don't have to follow a list of steps. But I also don't want to get in the way of dealing with other repos they work with, possibly even in the same project.

    I want

    • git config remote.<remote>.push HEAD:/refs/for/something
    • git config branch.<branch>.merge refs/head/something (where branch's remote is <remote>)

    Is there some way to configure this so that just by cloning the repo everything is set up properly?

    解决方案

    There isn't. That's intentional. Your repo is yours. You have complete control over what goes on in it, nothing happens until you explicitly act.

    To help others set up their repos correctly for your project easiest might be to provide a ~repo/config setup~ script they can run with or without looking at what it's going to do.

    Another thing you could do, though it looks a bit problematic for your needs here, is to set up the default repo template at your site with the configs you're suggesting. That way people at your site will get your desired setup by default. Anybody who knows enough to have their own default will have no trouble at all running a repo setup script.

    About as close as I can get to making the setup brainless is to provide a custom template, possibly by a simple frontender (e.g. complete contents git clone --template=path/to/yourproject/template "$@").

    这篇关于我可以在回购中指定.git / config的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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