Questions tagged [git-config]

This command allows get and set repository or global options.

You can query/set/replace/unset options with this command. The name is actually the section and the key separated by a dot, and the value will be escaped.

Multiple lines can be added to an option by using the --add option. If you want to update or unset an option which can occur on multiple lines, a POSIX regexp value_regex needs to be given. Only the existing values that match the regexp are updated or unset. If you want to handle the lines that do not match the regex, just prepend a single exclamation mark in front (see also [EXAMPLES]).

The type specifier can be either --int or --bool, to make git config ensure that the variable(s) are of the given type and convert the value to the canonical form (simple decimal number for int, a "true" or "false" string for bool), or --path, which does some path expansion (see --path below). If no type specifier is passed, no checks or transformations are performed on the value.

When reading, the values are read from the system, global and repository local configuration files by default, and options --system, --global, --local and --file can be used to tell the command to read from only that location (see [FILES]).

When writing, the new value is written to the repository local configuration file by default, and options --system, --global, --file can be used to tell the command to write to that location (you can say --local but that is the default).

This command will fail with non-zero status upon error. Some exit codes are:

  • The config file is invalid (ret=3),

  • Can not write to the config file (ret=4),

  • No section or name was provided (ret=2),

  • The section or key is invalid (ret=1),

  • You try to unset an option which does not exist (ret=5),

  • You try to unset/set an option for which multiple lines match (ret=5), or

  • You try to use an invalid regexp (ret=6).

On success, the command returns the exit code 0.

This command allows get and set repository or global options.

534 questions
0
votes
1 answer

how to save password to git config in encrypted format that is is not readable if .gitconfig is opened

I have made a git command in python, want user to save email password in git config but don't want any user to understand if he opens .gitconfig file !!
Ciasto piekarz
  • 6,378
  • 11
  • 59
  • 149
0
votes
0 answers

Git remote url alias rewrite

I'm working temporarily for a project. I'm using a VPN to connect and mount Windows' folder's git, the working repository to /mnt/project and the bare to /mnt/project-bare. I can, from my Ubuntu's local repository, pull/push to the distant git.…
Theos Morpork
  • 55
  • 1
  • 7
0
votes
1 answer

Syncing Local config to repository

I'm having trouble with my local .git/config settings pushing to bitbucket. I've been trying to set ignorecase to false, then push up the repo. When I reclone my repo, ignorecase is true again. git rm tempfile git commit -m "removing temp" git…
Kevin
  • 81
  • 2
  • 9
0
votes
1 answer

git keeps asking for email adress when commting

I reinstalled my machine and copied an old git repository. Now if i try to make a commit, git keeps complaining about a missing email address even though i have a ~/.gitconfig and a .git/config in my repository with the correct entries. Executing …
greole
  • 3,766
  • 5
  • 24
  • 48
0
votes
2 answers

Using SSH insteadof HTTPS just for fetch/clone

I would like do force all clone/pulls to get the data from SSH, but continue to use HTTPS for push. My command will always use https (git clone https://) and I can´t change this (lot of scritps using) but I would like to force the clone to use SSH,…
0
votes
1 answer

Why does this line cause a syntax error for my .gitconfigure file?

I'm trying to set up my git log command to automatically format the way I want to. Under the [pretty] section, below, git says there is an error in my syntax but I don't understand what it is. I'm following the man page as closely as…
Avery
  • 10,391
  • 15
  • 38
  • 53
0
votes
1 answer

I don’t have an origin remote in my .git/config. How can I fix that?

Not sure what I did wrong, but I started with a local repository, then pushed it to remote. (Yes, I am new.) My .git/config shows: [remote "devgit"] url = devgit:groupname/product fetch = +refs/heads/*:refs/remotes/devgit/* I really expected…
Fred Mitchell
  • 2,017
  • 1
  • 17
  • 28
0
votes
1 answer

Git config branch rebase true by pattern instead of name

Git documentation have the following: branch..rebase When true, rebase the branch on top of the fetched branch, instead of merging the default branch from the default remote when "git pull" is run. See "pull.rebase" for doing this in a…
erkfel
  • 1,384
  • 2
  • 15
  • 28
0
votes
2 answers

Point current repo to a different repo

I have a repository (A) where I have been building code, I also have a same older code version in a different repo (B) what is the best way to bring the repo (A) to repo (B). Eventually repo (A) should go away. Basically I want to point towards to…
add-semi-colons
  • 14,928
  • 43
  • 126
  • 211
0
votes
2 answers

Using a separate user for multiple Git remotes on the same repository

Is there a way to clone a repository, add a second remote, but use a different/separate user for that second remote automatically when pushing/pulling? My use case is to have the remote "origin" only for pulling (actually checking out) changes with…
thasmo
  • 7,142
  • 5
  • 24
  • 30
0
votes
3 answers

How to combine users in git repo?

I have a git repo, where I committed from different computers and so I ended up showing as 2 different contributors, but in fact it is one user - me. How I can unite these users into one?
Gulaev Valentin
  • 513
  • 1
  • 6
  • 16
0
votes
3 answers

How to set git:username automatically based on URL of remote repo

I have some git repositories on my local machine that are hobby projects (hosted on GitHub), and some that are work-related (hosted elsewhere). Because I am doing it wrong (don't ask, it's irrelevant) I periodically have to rm -rf and re-clone a…
Quuxplusone
  • 19,419
  • 5
  • 72
  • 137
-1
votes
1 answer

Git Config Double Quotes in PowerShell Round 2

I'm reposting this as it is not a duplicate. Please see my edit. This was asked here, but no solution was provided for PowerShell. The solution given does not work in PowerShell (specifically, PowerShell 5.1 within VSCode). I have tried git config…
A. Hendry
  • 1,521
  • 2
  • 11
  • 19
-1
votes
1 answer

Blocked user shown in a commit detail

I use a laptop that contains an old configuration: git global credentials git config --global user.email => blockeduser@email.com so when I push my first commit with my username & password, I found the blocked user in my commit detail how this can…
OAH
  • 932
  • 1
  • 8
  • 22
-1
votes
1 answer

what does git man pages [] mean

I am reading the man pages of git-config , you can check it here too. https://www.git-scm.com/docs/git-config/1.8.3 In synopsis , I am unable to understand what does [] mean , I have tried to look into its details of the man pages but…
Aqeel Raza
  • 1,279
  • 2
  • 11
  • 21
1 2 3
35
36