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