如何在git中共享配置文件? [英] How share a config file in git?

查看:98
本文介绍了如何在git中共享配置文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我想要在所有存储库中传播的编辑器设置。如果用户定义了自己的设置,它当然应该删除存储库选项。



我想这样做,因为我有一个班级,每个学生都克隆回购。通常他们会忘记设置core.editor设置,并最终使用vi来搞乱,通常会导致回购崩溃,就像他们有诅咒的魔法力量一样。



我的HOME目录,我试图在我的回购目录中使用.gitconfig,就像我将设置一个.gitignore,但它似乎不工作。

编辑:


  • - global code>允许用户设置它的首选项来覆盖回购,但它不允许他在克隆回购配置时获取回购配置。

  • .git / config不是在克隆的repo中共享


解决方案

使用rsync或tar / untar分发您的repo,正如你所见,git clone不会复制特殊文件。


I have editor settings that I want to spread in all repositories. If the user defines its own settings, it should erase the repository choices of course.

I want to do that because I have a class and every student clone the repo. Usually they forget to set the core.editor setting and ends up messing around with vi, usually crashing the repo just like if they have cursed magical power.

As it worked for my HOME dir, I tried to use a .gitconfig in my repo dir, like I would set a .gitignore, but it doesn't seem to work.

EDIT :

  • --global DOES let the user set its preference to override the repo, but it DOES'T allow him to fetch the repos config while cloning it.
  • .git/config is not shared among cloned repo

解决方案

Distribute your repo using rsync or tar/untar, rather than using "git clone", which as you have seen, does not copy repo-special files.

这篇关于如何在git中共享配置文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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