File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
GitFlowVersion/BuildServers Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change 1
1
namespace GitFlowVersion . GitFlowVersion
2
2
{
3
+ using System ;
3
4
using System . Linq ;
4
5
using LibGit2Sharp ;
5
6
@@ -14,7 +15,8 @@ public static void NormalizeGitDirectory(string gitDirectory)
14
15
Logger . WriteInfo ( string . Format ( "Fetching from remote '{0}' using the following refspecs: {1}." ,
15
16
remote . Name , string . Join ( ", " , remote . FetchRefSpecs . Select ( r => r . Specification ) ) ) ) ;
16
17
17
- repo . Network . Fetch ( remote ) ;
18
+ var fetchOptions = BuildFetchOptions ( ) ;
19
+ repo . Network . Fetch ( remote , fetchOptions ) ;
18
20
19
21
CreateMissingLocalBranchesFromRemoteTrackingOnes ( repo , remote . Name ) ;
20
22
@@ -30,6 +32,21 @@ public static void NormalizeGitDirectory(string gitDirectory)
30
32
}
31
33
}
32
34
35
+ static FetchOptions BuildFetchOptions ( )
36
+ {
37
+ var username = Environment . GetEnvironmentVariable ( "GITVERSION_REMOTE_USERNAME" ) ;
38
+ var password = Environment . GetEnvironmentVariable ( "GITVERSION_REMOTE_PASSWORD" ) ;
39
+
40
+ var fetchOptions = new FetchOptions ( ) ;
41
+
42
+ if ( ! string . IsNullOrEmpty ( username ) )
43
+ {
44
+ fetchOptions . Credentials = new Credentials { Username = username , Password = password } ;
45
+ }
46
+
47
+ return fetchOptions ;
48
+ }
49
+
33
50
static void CreateFakeBranchPointingAtThePullRequestTip ( Repository repo )
34
51
{
35
52
var remote = repo . Network . Remotes . Single ( ) ;
You can’t perform that action at this time.
0 commit comments