克隆git存储库时如何自动保留别名? [英] How can I automatically retain aliases when cloning a git repository?

查看:97
本文介绍了克隆git存储库时如何自动保留别名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在git仓库的配置文件中设置了一堆方便的别名。我偶尔会克隆此存储库(例如,复制到我的笔记本电脑上),但是该克隆不包含我设置的任何别名,大概是因为该克隆未复制存储别名的git config文件。但是,我希望在使用克隆时可以使用这些别名,而不必手动再次设置它们。有人找到了一个好的解决方案吗?

I have a bunch of handy aliases set up in the config file for my git repository. I will occasionally clone this repository (e.g. onto my laptop), but the clone does not included any of the aliases I've set up, presumably because the clone does not copy the git config file where the aliases are stored. I would, however, like to have these aliases available when working with the clone without having to set them up again manually. Has anyone found a good solution for this?

推荐答案

您可以将别名放入$ HOME / .gitconfig文件中以使其适用到一台计算机上的所有存储库。 (或共享主目录的机器集)。当然,那是我所有的地方。

You can put aliases into your $HOME/.gitconfig file to make them apply to all repositories on a single machine. (Or set of machines sharing home directories). That's certainly where I keep all mine.

这篇关于克隆git存储库时如何自动保留别名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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