LinuxCommandLibrary

git-init-db

Create a new Git repository database

SYNOPSIS

git init-db [--template=<template_directory>] [--bare] [--shared[=<permissions>]] [directory]

PARAMETERS

--bare
    Create bare repository without working tree.

--template=<template_directory>
    Initialize from contents of template_directory.

--shared[=<permissions>]
    Enable shared repository with specified permissions (e.g., umask, group, all).

directory
    Target directory for new repository (defaults to current).

DESCRIPTION

The git init-db command creates an empty Git repository in the specified directory, setting up the essential structure including .git folder, objects, refs, and initial configuration files.

It prepares a fresh repository ready for commits, suitable for starting version control on a project. Unlike modern tools, it focuses solely on database initialization without advanced features like submodule support.

Key uses include bootstrapping repositories on servers or local projects. Options enable customization, such as bare repositories (no working tree) or shared access for teams.

Originally the primary initialization tool in early Git, it performs core tasks like creating HEAD ref and default branches. However, due to its legacy status, users should note compatibility issues with newer Git versions.

This command exemplifies Git's plumbing layer, handling low-level repository setup reliably across platforms.

CAVEATS

Deprecated: Superseded by git init. Not available in Git 2.32.0+. May lack modern options like --initial-branch.

MIGRATION TIP

Replace with git init for identical functionality plus enhancements like separate Git dir support.

LEGACY USE

Still referenced in old scripts; check Git version before use.

HISTORY

Created by Linus Torvalds in 2005 as Git's first init command. Renamed to git init in Git 1.6.3 (2009) for consistency. Deprecated in 1.8.0; removed in 2.32.0 (2021) to streamline porcelain commands.

SEE ALSO

git-init(1), git-clone(1), git(1)

Copied to clipboard