Skip to content

Commit 55ad487

Browse files
Guy Hughesguyzmo
authored andcommitted
prefer gitrepo.<target>.token > privatekey, docs
1 parent 07fab3e commit 55ad487

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,13 @@ To configure `git-repo` you need to tweak your `~/.gitconfig`. For each service
123123
you've got an account on, you have to make a section in the gitconfig:
124124

125125
[gitrepo "gitlab"]
126-
private_token = YourVerySecretKey
126+
token = YourVerySecretKey
127127

128128
[gitrepo "github"]
129-
private_token = YourOtherVerySecretKey
129+
token = YourOtherVerySecretKey
130130

131131
[gitrepo "bitbucket"]
132-
private_token = username:password
132+
token = username:password
133133

134134
Here, we're setting the basics: just the private token. You'll notice that for bitbucket
135135
the private token is your username and password seperated by a column. That's because
@@ -140,7 +140,7 @@ You also have the ability to set up an alias:
140140

141141
[gitrepo "bitbucket"]
142142
alias = bit
143-
private_token = username:password
143+
token = username:password
144144

145145
that will change the command you use for a name you'll prefer to handle actions
146146
for the service you use:
@@ -151,7 +151,7 @@ Also, you can setup your own gitlab self-hosted server, using that configuration
151151

152152
[gitrepo "myprecious"]
153153
type = gitlab
154-
private_token = YourSuperPrivateKey
154+
token = YourSuperPrivateKey
155155
fqdn = gitlab.example.org
156156

157157
Finally, to make it really cool, you can make a few aliases in your gitconfig:

git_repo/repo.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,18 +62,18 @@
6262
Configuration options:
6363
alias Name to use for the git remote
6464
url URL of the repository
65-
private-key Private key to use for connecting to the service
65+
token Private token to use for connecting to the service
6666
type Name of the service to use (github, gitlab, bitbucket)
6767
6868
Configuration example:
6969
7070
[gitrepo "gitlab"]
71-
private-key = YourSecretKey
71+
token = yourapitoken
7272
alias = lab
7373
7474
[gitrepo "personal"]
7575
type = gitlab
76-
private-key = YourSecretKey
76+
token = yourapitoken
7777
url = http://custom.org
7878
7979
{self} version {version}, Copyright ⓒ2016 Bernard `Guyzmo` Pratz

git_repo/services/service.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,13 @@ def __init__(self, r=None, c=None):
138138
self.name = name
139139
# if not in the configuration file, retrieve the private key from the
140140
# environment (useful for travis configuration), otherwise, make it None.
141-
# using "privatekey" or "private_token" in configuration file to avoid
141+
# using "token" > "private_token" > "privatekey" in configuration file to avoid
142142
# confusion with the SSH keys (yes that happened).
143+
# NB: `git config` doesn't parse underscores in option names, token.
143144
self._privatekey = os.environ.get('PRIVATE_KEY_{}'.format(self.name.upper()),
144-
c.get('private_token',
145-
c.get('privatekey', None)))
145+
c.get('token',
146+
c.get('private_token',
147+
c.get('privatekey', None))))
146148
self._alias = c.get('alias', self.name)
147149
self.fqdn = c.get('fqdn', self.fqdn)
148150

0 commit comments

Comments
 (0)