git config --global代替项目的OfOf,而不是全局的 [英] git config --global insteadOf for a project, not global

查看:433
本文介绍了git config --global代替项目的OfOf,而不是全局的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用命令创建了一个 .gitconfig 文件

I created a .gitconfig file using the command

git config --global url."https://".insteadOf git://

但是,对于我计算机上的所有项目,这将用https://替换所有 git://URL.

However, this will replace all git:// URLs WITH https:// ones, for all projects on my computer.

我想要针对特定​​项目的此功能.是否可以为某个项目/不是全局项目配置 git://URL替换https://URL ?

I want this functionality, for a specific project. Is it possible to configure a replace for git:// URLs for https:// URLs for a certain project/not global?

这个项目是共享的,我不希望每个人都在本地运行命令.

This project is shared, and I don't want everyone to go through the trouble of running the command locally.

推荐答案

您可以执行以下操作:

  1. 编辑.gitconfig文件,然后删除[url]部分.

  1. Edit .gitconfig file and just remove the [url] section.

Cd插入要在其中运行此 的项目中.

Cd into the project in which you want this instead to work.

运行 git配置url."https://" .insteadOf git://

说明:

git config --global 是您在用户范围内的设置,即它应用于该用户主目录中的所有项目.配置文件是 .gitconfig ,它位于用户的homedir

git config --global is your user-wide setting, i.e it is applied to all projects in that users home dir. The config file is .gitconfig and it resides in user's homedir

git config 是存储库特定的配置.如果在$ GIT_DIR/config文件中添加一个条目.因此,它仅特定于该目录

git config is repository specific configuration. If adds an entry in your $GIT_DIR/config file. So it is specific to only that directory

希望有帮助!

开心的混蛋!

这篇关于git config --global代替项目的OfOf,而不是全局的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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