@@ -5,22 +5,20 @@ users / user identities.
5
5
6
6
## Get it!
7
7
```
8
- >:mkdir -p ~/.git/hooks/bin && cd $_
9
- >:git clone git://github.com/frace/git-passport.git
10
- >:chmod +x ./git-passport/git-passport.py
11
- >:_
8
+ mkdir -p ~/.git/hooks/bin && cd $_
9
+ git clone git://github.com/frace/git-passport.git
10
+ chmod +x ./git-passport/git-passport.py
12
11
```
13
12
14
13
15
14
## Installation
16
- There are many ways to handle your hooks. What I do in oder to work with
15
+ There are many ways to handle your hooks. What I do in order to work with
17
16
multiple hooks is the following solution:
18
17
```
19
- >:mkdir -p ~/.git/hooks/pre-commit.d && cd $_
20
- >:ln -sf ~/.git/hooks/bin/git-passport/git-passport.py ./00-git-passport
21
- >:mkdir -p ~/.git/templates/hooks && cd $_
22
- >:touch pre-commit && chmod +x $_
23
- >:_
18
+ mkdir -p ~/.git/hooks/pre-commit.d && cd $_
19
+ ln -sf ~/.git/hooks/bin/git-passport/git-passport.py ./00-git-passport
20
+ mkdir -p ~/.git/templates/hooks && cd $_
21
+ touch pre-commit && chmod +x $_
24
22
```
25
23
26
24
Add the Git template directory path into your ` ~/.gitconfig ` and create an
@@ -37,15 +35,13 @@ command by invoking `git passport`:
37
35
In ` ~/.git/templates/hooks/pre-commit ` I put a little bash script which
38
36
loads one hook after another:
39
37
```
40
- >:cat ~/.git/templates/hooks/pre-commit
41
38
#!/usr/bin/env bash
42
39
43
40
hooks_pre_commit="${HOME}/.git/hooks/pre-commit.d/"
44
41
45
42
for hook in ${hooks_pre_commit}*; do
46
43
"$hook"
47
44
done
48
- >:_
49
45
```
50
46
51
47
Afterwards each ` git init ` or ` git clone ` command will distribute
@@ -58,16 +54,14 @@ If you want to apply the hook to already exisiting repos then just run
58
54
On the first run ` git-passport.py ` generates a sample configuration file inside
59
55
your home directory:
60
56
```
61
- >:cd ~/.git/hooks/bin/git-passport
62
- >:./git-passport.py
63
- No configuration file found in ~/.
64
- Generating a sample configuration file.
65
- >:_
57
+ cd ~/.git/hooks/bin/git-passport
58
+ ./git-passport.py
59
+ No configuration file found in ~/.
60
+ Generating a sample configuration file.
66
61
```
67
62
68
- The configuration file is rather self-explanatory:
63
+ The configuration file ` ~/.gitpassport ` is rather self-explanatory:
69
64
```
70
- >:cat ~/.gitpassport
71
65
[general]
72
66
enable_hook = True
73
67
sleep_duration = 0.5
@@ -81,7 +75,6 @@ service = github.com
81
75
82
76
name = name_1
83
77
service = gitlab.com
84
- >:_
85
78
```
86
79
87
80
Adjust the existing sections and add as many passports as you like by following
@@ -94,18 +87,17 @@ during each `git commit` command.
94
87
You can pass the following options if you use ` git-passport.py ` as a Git
95
88
command, too:
96
89
```
97
- >:git passport -h
98
- usage: git passport (--select | --delete | --active | --passports)
99
-
100
- manage multiple Git identities
101
-
102
- optional arguments:
103
- -h show this help message and exit
104
- -s, --select select a passport
105
- -d, --delete delete the active passport in .git/config
106
- -a, --active print the active passport in .git/config
107
- -p, --passports print all passports in ~/.gitpassport
108
- >:_
90
+ git passport -h
91
+ usage: git passport (--select | --delete | --active | --passports)
92
+
93
+ manage multiple Git identities
94
+
95
+ optional arguments:
96
+ -h show this help message and exit
97
+ -s, --select select a passport
98
+ -d, --delete delete the active passport in .git/config
99
+ -a, --active print the active passport in .git/config
100
+ -p, --passports print all passports in ~/.gitpassport
109
101
```
110
102
111
103
0 commit comments