Function setConfig

  • Write an entry to the git config files.

    Caveats:

    • Currently only the local $GIT_DIR/config file can be read or written. However support for the global ~/.gitconfig and system $(prefix)/etc/gitconfig will be added in the future.
    • The current parser does not support the more exotic features of the git-config file format such as [include] and [includeIf].

    Returns

    Resolves successfully when operation completed.

    Example

    // Write config value
    await setConfig({
    fs,
    dir: '/tutorial',
    path: 'user.name',
    value: 'Mr. Test'
    })

    // Print out config file
    let file = await fs.readFile('/tutorial/.git/config', { encoding : 'utf8' })
    console.log(file)

    // Delete a config entry
    await setConfig({
    fs,
    dir: '/tutorial',
    path: 'user.name',
    value: undefined
    })

    // Print out config file
    file = await fs.readFile('/tutorial/.git/config', { encoding: 'utf8' })
    console.log(file)

    Type Parameters

    • T extends string

    Parameters

    Returns Promise<void>

Generated using TypeDoc