Git config: Difference between revisions
(2 intermediate revisions by the same user not shown) | |||
Line 81: | Line 81: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
The configuration setting is overridden by the <code>[[Git_Environment_Variables#GIT_SSL_NO_VERIFY|GIT_SSL_NO_VERIFY]]</code> environment variable. | The configuration setting is overridden by the <code>[[Git_Environment_Variables#GIT_SSL_NO_VERIFY|GIT_SSL_NO_VERIFY]]</code> environment variable. | ||
==Configure <tt>[url]</tt>== | ==<span id='Configure_url'></span>Configure and Read <tt>[url]</tt> <tt>insteadOf</tt>== | ||
To read: | |||
<syntaxhighlight lang='bash'> | |||
git config --get url."git@github.com:someorg/somerepo".insteadof | |||
</syntaxhighlight> | |||
To configure: | |||
<syntaxhighlight lang='bash'> | <syntaxhighlight lang='bash'> | ||
git config --global url."git@github.com:someorg/somerepo".insteadof "https://github.com/someorg/somerepo" | git config --global url."git@github.com:someorg/somerepo".insteadof "https://github.com/someorg/somerepo" | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Also see: {{Internal|Git_Configuration#insteadOf|Git Configuration <tt>url</tt> <tt>insteadOf</tt>}} |
Latest revision as of 23:21, 9 January 2024
Internal
Overview
git config
is used to read and manipulate entries in the Git configuration files.
More info:
git config --help
Configuration Operations
List the Configuration
git config [--system|--global|--local] -l
List the Remote Origin URL
git config --get remote.<origin-name>.url
git config --get remote.origin.url
Configure a Setting
git config [--system|--global|--file] <some.git.option> <value>
git config --global push.autoSetupRemote true
Get a Setting
git config --get <some.git.option.name>
Remove a Setting
git config --unset [--file|--global|--system] <some.git.option>
Remote Manipulation
See:
Recipes
Configure the Commit Author
This command configures the current repository only (--local
is implied by default):
git config user.name "Ovidiu Feodorov"
git config user.email "ovidiu@example.com"
The configuration propagates to .git/config [user]
section.
The same effect can be achieved by setting GIT_AUTHOR_NAME
and GIT_AUTHOR_EMAIL
environment variables.
To configure commit author information for all repositories the user interacts with, use --global
. If set on a specific repository, the repository-specific setting will take precedence. For more details on configuration hierarchy, see Git Configuration.
git config --global user.name "Ovidiu Feodorov"
git config --global user.email "ovidiu@example.com"
Configure an Alias
git config --global alias.show-graph 'log --graph --abbrev-commit --pretty=oneline'
Turn Off SSL Server Certificate Verification for a Specific Repository
The setting is controlled by http.sslVerify
configuration element:
cd <repository_dir>
git config http.sslVerify true|false
and ends up in modifying .git/config
's [http]
section as follows:
[http]
sslVerify = true|false
The configuration setting is overridden by the GIT_SSL_NO_VERIFY
environment variable.
Configure and Read [url] insteadOf
To read:
git config --get url."git@github.com:someorg/somerepo".insteadof
To configure:
git config --global url."git@github.com:someorg/somerepo".insteadof "https://github.com/someorg/somerepo"
Also see: