Git Product home page Git Product logo

karn's Introduction

Build Status

karn: Manage multiple Git identities with ease

Setup your Git repositories to always use a specific identity based on the directory tree.

With karn, you never have to manually change the local repository configuration to a different identity from your global.

karn will change your repository's local user.name and user.email configuration if necessary, but will never modify your global configuration.

Install

Homebrew (OS X)

Install using Homebrew on OS X

brew install karn

Pre-built binary

Head to the releases page to download pre-built binaries for OS X/Linux/Windows.

Go

You can install karn using Go with the following command:

go get github.com/prydonius/karn/cmd/karn

Arch Linux

karn has a AUR package: https://aur.archlinux.org/packages/karn/. You can install it using your AUR helper of choice.

Usage

karn can be used in two ways!

Automatically check for identity updates before running a Git command

Note: this method overrides the git command with a function that runs karn update before executing the original Git command. Run karn init to see exactly what the git command is overriden with

If you're okay with the scary warnings above, add the following line to your shell startup script (e.g. .bash_profile, .zshrc)

if which karn > /dev/null; then eval "$(karn init)"; fi

If you run on fish you can put this line in your config.fish

alias git="karn update; command git $argv"

Run manually when you want to update

Alternatively, you can run karn update manually in a Git repository whenever you need to update your identity for that repository.

Configuring Identities

karn looks for a YAML configuration file in your home directory, ~/.karn.yml.

A sample configuration looks like this:

---
~/Fun:
  name: Adnan Abdulhussein
  email: [email protected]
~/Fun/karn:
  name: Sisterhood of Karn
  email: [email protected]
/Work:
  name: Adnan A
  email: [email protected]
  signingKey: 3AA5C34371567BD2

In a given repo, karn will try to match with the deepest configured directory. For the configuration above, any repo under the ~/Fun directory will match the first identity, with the exception of ~/Fun/karn which matches the second identity. If an identity isn't found, the repo is left untouched.

karn's People

Contributors

captn3m0 avatar chenrui333 avatar danielmschmidt avatar mkmik avatar prydonius avatar sschuberth avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.