@@ -601,6 +601,7 @@ function isdir_windows_workaround(path::String)
601
601
end
602
602
603
603
function handle_repos_develop! (ctx:: Context , pkgs:: AbstractVector{PackageSpec} )
604
+ creds = LibGit2. CachedCredentials ()
604
605
env = ctx. env
605
606
for pkg in pkgs
606
607
pkg. repo == nothing && continue
@@ -623,12 +624,12 @@ function handle_repos_develop!(ctx::Context, pkgs::AbstractVector{PackageSpec})
623
624
repo, just_cloned = ispath (repo_path) ? (LibGit2. GitRepo (repo_path), false ) : begin
624
625
printpkgstyle (ctx, :Cloning , " package from $(pkg. repo. url) " )
625
626
r = LibGit2. clone (pkg. repo. url, repo_path)
626
- LibGit2 . fetch (r, remoteurl= pkg. repo. url, refspecs= refspecs)
627
+ GitTools . fetch (r, remoteurl= pkg. repo. url, refspecs= refspecs, credentials = creds )
627
628
r, true
628
629
end
629
630
if ! just_cloned
630
631
printpkgstyle (ctx, :Updating , " repo from $(pkg. repo. url) " )
631
- LibGit2 . fetch (repo, remoteurl= pkg. repo. url, refspecs= refspecs)
632
+ GitTools . fetch (repo, remoteurl= pkg. repo. url, refspecs= refspecs, credentials = creds )
632
633
end
633
634
close (repo)
634
635
@@ -660,6 +661,7 @@ function handle_repos_develop!(ctx::Context, pkgs::AbstractVector{PackageSpec})
660
661
end
661
662
662
663
function handle_repos_add! (ctx:: Context , pkgs:: AbstractVector{PackageSpec} ; upgrade_or_add:: Bool = true )
664
+ creds = LibGit2. CachedCredentials ()
663
665
env = ctx. env
664
666
for pkg in pkgs
665
667
pkg. repo == nothing && continue
@@ -669,15 +671,15 @@ function handle_repos_add!(ctx::Context, pkgs::AbstractVector{PackageSpec}; upgr
669
671
mkpath (clones_dir)
670
672
repo_path = joinpath (clones_dir, string (hash (pkg. repo. url)))
671
673
repo, just_cloned = ispath (repo_path) ? (LibGit2. GitRepo (repo_path), false ) : begin
672
- r = GitTools. clone (pkg. repo. url, repo_path, isbare= true )
673
- LibGit2 . fetch (r, remoteurl= pkg. repo. url, refspecs= refspecs)
674
+ r = GitTools. clone (pkg. repo. url, repo_path, isbare= true , credentials = creds )
675
+ GitTools . fetch (r, remoteurl= pkg. repo. url, refspecs= refspecs, credentials = creds )
674
676
r, true
675
677
end
676
678
info = manifest_info (env, pkg. uuid)
677
679
pinned = (info != nothing && get (info, " pinned" , false ))
678
680
if upgrade_or_add && ! pinned && ! just_cloned
679
681
printpkgstyle (ctx, :Updating , " repo from $(pkg. repo. url) " )
680
- LibGit2 . fetch (repo, remoteurl= pkg. repo. url, refspecs= refspecs)
682
+ GitTools . fetch (repo, remoteurl= pkg. repo. url, refspecs= refspecs, credentials = creds )
681
683
end
682
684
if upgrade_or_add && ! pinned
683
685
rev = pkg. repo. rev
@@ -928,10 +930,11 @@ function registries()::Vector{String}
928
930
user_regs = abspath (depots ()[1 ], " registries" )
929
931
if ! ispath (user_regs)
930
932
mkpath (user_regs)
933
+ creds = LibGit2. CachedCredentials ()
931
934
printpkgstyle (stdout , :Cloning , " default registries into $user_regs " )
932
935
for (reg, url) in DEFAULT_REGISTRIES
933
936
path = joinpath (user_regs, reg)
934
- GitTools. clone (url, path; header = " registry $reg from $(repr (url)) " )
937
+ GitTools. clone (url, path; header = " registry $reg from $(repr (url)) " , credentials = creds )
935
938
end
936
939
end
937
940
return [r for d in depots () for r in registries (d)]
0 commit comments