我可以注释掉 .git/config 文件中的一行吗?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21297970/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 17:37:28  来源:igfitidea点击:

Can I comment out a line in a .git/config file?

gitproxyconfig

提问by n370

I have a http.proxyline on my repository configuration file that I would like to 'turn on and off' easily without having to remember and type again the whole configuration every time I'm behind or free from this proxied connection.

我的http.proxy存储库配置文件中有一行,我想轻松地“打开和关闭”,而不必每次我落后于或摆脱此代理连接时都要记住并再次键入整个配置。

Another possibility would be to use this repository configuration file when I'm behind the proxy and when not, use a global/local configuration file without any proxy setup.

另一种可能性是当我在代理后面时使用这个存储库配置文件,如果没有,则使用没有任何代理设置的全局/本地配置文件。

回答by Chris

Yes, you can comment lines out of Git config files using #or ;.

是的,您可以使用#或注释 Git 配置文件中的行;

From the documentation:

文档

Syntax

The syntax is fairly flexible and permissive; whitespaces are mostly ignored. The #and ;characters begin comments to the end of line, blank lines are ignored.

句法

语法相当灵活和宽松;空格大多被忽略。在#;字符开头的注释行的末尾,空行被忽略。