-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a1c704b
commit 07437e8
Showing
5 changed files
with
87 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,68 @@ | ||
# git-helper-substitute | ||
git credential helper, which switches git credentials for the organization | ||
|
||
git credential helper, which switches git credentials for the username/organization. | ||
|
||
If you are using multiple github accounts, it uses the information of the organization to determine the authentication information. | ||
|
||
# Installation | ||
|
||
``` | ||
go get -u github.com/sadayuki-matsuno/git-credential-substitute | ||
``` | ||
|
||
# Features | ||
|
||
- Store credentials for each github organization and use the appropriate credentials | ||
- If you're in the git directory, it will determine the credential based on the organization information in the origin and use it. | ||
- If not applicable to any organization, the default credentials are used. | ||
|
||
# Quick Start | ||
|
||
- install git-credential-substitute | ||
|
||
``` | ||
go get -u github.com/sadayuki-matsuno/git-credential-substitute | ||
``` | ||
|
||
- make .git-secret.json | ||
|
||
``` | ||
cat $HOME/.git-secret.json | ||
{ | ||
"another-organization": { | ||
"username": "another-github-username", | ||
"password": "xxxxxxxxxxxxxxxxxxxxxxx" | ||
}, | ||
"default": { | ||
"username": "sadayuki-matsuno", | ||
"password": "xxxxxxxxxxxxxxxx" | ||
} | ||
} | ||
``` | ||
|
||
- change git-credential-helper | ||
|
||
``` | ||
git config --global credential.helper substitute | ||
``` | ||
|
||
- check your git-credential-healper | ||
|
||
``` | ||
git config --show-origin --get credential.helper | ||
file:$HOME/.gitconfig substitute | ||
``` | ||
|
||
**If you see other helpers, you need to remove their settings or they may not work properly.** | ||
|
||
- All settings are complete. All that's left to do is to use the git command as usual | ||
|
||
# Debug | ||
|
||
To check which directory uses which credentials, try running `git-credential-substitute` in the target directory. | ||
|
||
# Author | ||
|
||
sadayuki-matsuno |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module github.com/sadayuki-matsuno/git-credential-substitute | ||
|
||
go 1.13 | ||
|
||
require github.com/urfave/cli/v2 v2.2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= | ||
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY= | ||
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= | ||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= | ||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= | ||
github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q= | ||
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= | ||
github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= | ||
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= | ||
github.com/urfave/cli/v2 v2.2.0 h1:JTTnM6wKzdA0Jqodd966MVj4vWbbquZykeX1sKbe2C4= | ||
github.com/urfave/cli/v2 v2.2.0/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ= | ||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | ||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters