Josh
Josh

Reputation: 1307

How does one change the default .git/config contents when creating/cloning a git repo?

Every time you create or clone a git repo, git creates a local .git/config file that you can use to set local project-level git configs that won't be checked in to source. On my version of git (2.17.1), it looks like this:

[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true

Is it possible to change this default .git/config template?

Upvotes: 1

Views: 196

Answers (1)

VonC
VonC

Reputation: 1329112

You could change it through the git clone [--template=<template_directory>] option.

That option is detailed in git init

Files and directories in the template directory whose name do not start with a dot will be copied to the $GIT_DIR after it is created.

That can include a default config file.

Upvotes: 1

Related Questions