File tree Expand file tree Collapse file tree 3 files changed +17
-1
lines changed Expand file tree Collapse file tree 3 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -65,6 +65,17 @@ Options:
65
65
EOF
66
66
exit ;
67
67
}
68
+
69
+ # If cloning private repos it is necessary to pass the authentication
70
+ # information to the git command. It is not possible to do this using
71
+ # Git::Repository, so an alternative is to use git's GIT_ASKPASS option, which
72
+ # is a command to run that will return the password (it is not possible to pass
73
+ # the password directly in an environment variable). The github_backup_pass
74
+ # command simply echos the GITHUB_TOKEN value, which can be used in place of a
75
+ # password for authentication, thus allowing access to the private repos. This
76
+ # option is ignored if it doesn't exist or returns nothing.
77
+ $ENV {GIT_ASKPASS }=" github_backup_pass" ;
78
+
68
79
my $gh = Github::Backup-> new(
69
80
api_user => $opts {user },
70
81
token => $opts {token },
Original file line number Diff line number Diff line change
1
+ echo $GITHUB_TOKEN
Original file line number Diff line number Diff line change @@ -284,7 +284,11 @@ Mandatory: Your Github username.
284
284
285
285
Mandatory: Your Github API token. If you wish to not include this on the
286
286
command line, you can put the token into the C<GITHUB_TOKEN > environment
287
- variable.
287
+ variable. Specifying the token in the C<GITHUB_TOKEN > environment variable also
288
+ enables private repositories to be accessed, as github_backup will use the
289
+ environment variable via the github_backup_pass command and git's
290
+ C<GIT_ASKPASS > option to pass the required authentication information to git
291
+ when cloning a repository.
288
292
289
293
=head2 -l | --list
290
294
You can’t perform that action at this time.
0 commit comments