Socket
Socket
Sign inDemoInstall

gitconfiglocal

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gitconfiglocal

parse the .git/config file into a useful data structure


Version published
Maintainers
1
Created

What is gitconfiglocal?

The gitconfiglocal npm package allows you to read and manipulate local Git configuration files. It provides a simple API to access and modify the .git/config file in a Git repository.

What are gitconfiglocal's main functionalities?

Read Local Git Config

This feature allows you to read the local Git configuration of a repository. The code sample demonstrates how to use the gitconfiglocal package to read the .git/config file of a specified repository.

const gitconfiglocal = require('gitconfiglocal');
const path = require('path');

const repoPath = path.resolve('/path/to/repo');
gitconfiglocal(repoPath, (err, config) => {
  if (err) throw err;
  console.log(config);
});

Modify Local Git Config

This feature allows you to modify the local Git configuration of a repository. The code sample demonstrates how to read the .git/config file, modify the user name and email, and then write the changes back to the file.

const gitconfiglocal = require('gitconfiglocal');
const fs = require('fs');
const ini = require('ini');
const path = require('path');

const repoPath = path.resolve('/path/to/repo');
gitconfiglocal(repoPath, (err, config) => {
  if (err) throw err;
  config.user.name = 'New User';
  config.user.email = 'newuser@example.com';
  fs.writeFileSync(path.join(repoPath, '.git', 'config'), ini.stringify(config));
});

Other packages similar to gitconfiglocal

Keywords

FAQs

Package last updated on 15 Feb 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc