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
2 answers

Why does 'git config' create multiple config entries in some cases?

I was trying to set up some git aliases and noticed a strange thing about git config: $ git config user.name foo # this stores the new name, ok $ git config user.name bar baz # this adds a 'name = bar' entry to the config, wtf? $ git config…
planetp
  • 10,603
  • 14
  • 62
  • 124
0
votes
1 answer

Reject git merges by branch name prefix

How can I configure my git repository to reject all merge responses when the current branch name have a specific prefix? I would like to preserve my master branch against merges from branches that are spike solutions which have a prefix like…
Alucard
  • 308
  • 3
  • 15
0
votes
3 answers

Git config alias issue

I'm trying to create an alias for my "merge to staging" workflow. Let's say I've finished a task in branch "dev/layout_fix" and want to deploy it to staging after commiting. This is my way: git checkout staging git merge dev/layout_fix --no-ff git…
bambamboole
  • 513
  • 9
  • 24
0
votes
1 answer

How do I change the clone URL for my GIT repositories?

I have moved my Git repository from one IP to a different IP. And now I am facing a problem with changing it's clone url. Old URL: 1] http://105.15.96.261/something/some_repo.git Now I have moved to a new IP & I want the clone url to be: 2]…
vishal kokate
  • 118
  • 2
  • 12
0
votes
1 answer

is it possible to not make any newline conversions with git

I'm not sure how much detail is needed about our setup / workflow but the bottom line is I am trying to find a config that does no newline conversion what-so-ever, not on check-in, not on check-out. Some of the applications files use windows…
Alex
  • 53
  • 5
0
votes
2 answers

Store credentials for git commands using HTTP

I would like to store Git credentials for git pulls permenantly on a linux machine, and git credential.helper doesn't work ( I think because I'm not using SSH ) - I get that error "Fatal: could not read password for 'http://....': No such device or…
Poka Yoke
  • 333
  • 2
  • 8
  • 25
0
votes
1 answer

Git pull from other user than in config

I have repository created and the following config file: [core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true [remote "origin"] url = https://user@github.com/repo/repo.git fetch =…
Marcin Nabiałek
  • 98,126
  • 37
  • 219
  • 261
0
votes
1 answer

Understanding git-svn configuration

git-svn man page has this example: [svn-remote "project-a"] url = http://server.org/svn fetch = trunk/project-a:refs/remotes/project-a/trunk So, as I understand it, it configures the svn to fetch changes from…
Max Yankov
  • 10,076
  • 10
  • 54
  • 116
0
votes
1 answer

Configure merge options for a particular remote repository in git?

I'd like to use a particular merge option ('ours') for the recursive strategy when pulling from a particular remote repository, but not others. I know about git config branch..mergeoptions "-Xours", but that's per-branch rather than per-remote…
bsmith89
  • 203
  • 2
  • 6
0
votes
2 answers

SSH external connections do not have my git config

I have setup git nicely locally. I can push and pull without entering my passphrase. This all works great when i open up a terminal locally. But when I SSH in from home I seem to have lost my git config or something as when I pull i get "Enter…
Wardy277
  • 33
  • 6
0
votes
1 answer

Commits on github are linked to right user while pushes are linked to wrong user

Commits(for new or old branch) done after changing the username and email are linked to me while Pushes(for both old and new branch) are for old user. Moreover if I setup a new project or anything new as generating ssh keys I get the message in…
techdreams
  • 4,537
  • 7
  • 38
  • 54
0
votes
1 answer

Is there a GUI tool to manage and view Git configuration?

Something that shows your current config and allows you to change some.
Alexander Suraphel
  • 8,105
  • 7
  • 43
  • 80
0
votes
2 answers

Create both remote and local git respositories on same system?

I am having trouble with this. What I am trying to do is create a central git repository locally and then clone it to make a working copy. When I make changes to the clone and push the changes, I do not get any error in SourcTree but the changes…
Hammad Khan
  • 14,008
  • 14
  • 100
  • 123
0
votes
2 answers

Color git commiter name

I'm working on a project with few people, it's my first time using git, and I found enjoyable coloring git output. For example: git log --graph --format='%C(yellow bold)%h%Creset %C(white bold)%s%Creset%n %C(magenta bold)%cr%Creset …
0
votes
1 answer

How can I edit/remove the " u= " marker in git-sh

Using rtomayko's git-sh, I've noticed a marker that I haven't seen in the examples. u= (which I imagine stands for upstream) tells me how many commits I've committed locally, but have not pushed to the remote repo. I'd like to update it's styling,…
Salar
  • 831
  • 8
  • 13