# How to bypass username/password prompt when updating private packages

**URL:** <https://discourse.julialang.org/t/how-to-bypass-username-password-prompt-when-updating-private-packages/2574>\
**Category:** General Usage\
**Tags:** package\
**Created:** [March 9, 2017, 7:42pm UTC](https://discourse.julialang.org/t/how-to-bypass-username-password-prompt-when-updating-private-packages/2574 "2017-03-09T19:42:18Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![BVPs](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bvps/32/2190_2.png) [@BVPs](https://discourse.julialang.org/u/BVPs)\
**Post date:** [March 9, 2017, 7:42pm UTC](https://discourse.julialang.org/t/how-to-bypass-username-password-prompt-when-updating-private-packages/2574/1 "2017-03-09T19:42:18Z")

</div>

I have some private packages on [GitLab.com](http://GitLab.com), and just added one of them via `Pkg.clone("https://gitlab.com/...")`. Now, it set things up correctly, but whenever I run `Pkg.update()`, julia asks me my username and password on [GitLab.com](http://GitLab.com), which is annoying especially using atom-juno editor. Is there any way to store my username and password information of GitLab (and presumably GitHub if I used some private packages there) in order to avoid this prompt? Would it be better to use ssh instead of https in `Pkg.clone` if I want to bypass entering my username and password info every time when I do `Pkg.update()`?  
Thanks!  
BVPs

---

<div class="post-metadata">

**Author:** ![BVPs](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bvps/32/2190_2.png) [@BVPs](https://discourse.julialang.org/u/BVPs)\
**Post date:** [March 10, 2017, 5:31am UTC](https://discourse.julialang.org/t/how-to-bypass-username-password-prompt-when-updating-private-packages/2574/2 "2017-03-10T05:31:49Z")

</div>

I could manage bypassing login prompt by generating and adding SSH keys at [gitlab.com](http://gitlab.com) and using `Pkg.clone("git@gitlab.com:...")` instead of `Pkg.clone("https://gitlab.com/...")`. Both on Mac OS X and ubuntu/linux, this worked. However, on a windows machine, it failed with the following error:

```julia
ERROR: ArgumentError: drive mismatch: METADATA git@gitlab.com:...
 in joinpath(::String, ::String) at .\path.jl:82
 in clone(::String) at .\pkg\entry.jl:210
 in (::Base.Pkg.Dir.##2#3{Array{Any,1},Base.Pkg.Entry.#clone,Tuple{String}})() at .\pkg\dir.jl:31
 in cd(::Base.Pkg.Dir.##2#3{Array{Any,1},Base.Pkg.Entry.#clone,Tuple{String}}, ::String) at .\file.jl:48
 in #cd#1(::Array{Any,1}, ::Function, ::Function, ::String, ::Vararg{Any,N}) at .\pkg\dir.jl:31
 in clone(::String) at .\pkg\pkg.jl:151

```

How could I resolve this problem on windows? I’m using julia v0.5.1 and windows 10.

---

<div class="post-metadata">

**Author:** ![Tero\_Frondelius](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tero_frondelius/32/7629_2.png) [@Tero\_Frondelius](https://discourse.julialang.org/u/Tero_Frondelius)\
**Post date:** [March 10, 2017, 6:19am UTC](https://discourse.julialang.org/t/how-to-bypass-username-password-prompt-when-updating-private-packages/2574/3 "2017-03-10T06:19:43Z")

</div>

> [@BVPs](#):
>
> How could I resolve this problem on windows? I’m using julia v0.5.1 and windows 10.

In Windows 7, I have used git bash: [https://git-for-windows.github.io](https://git-for-windows.github.io)

---

<div class="post-metadata">

**Author:** ![BVPs](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bvps/32/2190_2.png) [@BVPs](https://discourse.julialang.org/u/BVPs)\
**Post date:** [March 10, 2017, 7:38am UTC](https://discourse.julialang.org/t/how-to-bypass-username-password-prompt-when-updating-private-packages/2574/4 "2017-03-10T07:38:30Z")

</div>

@Tero_Frondelius, thanks for your reply. But I have been using git-bash on my windows 10 machine. In fact, using git-bash, I generated the SSH keys. Yet, `Pkg.clone("git@gitlab.com:...")` produced the error as I reported.

---

<div class="post-metadata">

**Author:** ![Tero\_Frondelius](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tero_frondelius/32/7629_2.png) [@Tero\_Frondelius](https://discourse.julialang.org/u/Tero_Frondelius)\
**Post date:** [March 10, 2017, 4:33pm UTC](https://discourse.julialang.org/t/how-to-bypass-username-password-prompt-when-updating-private-packages/2574/5 "2017-03-10T16:33:43Z")

</div>

```bash
cd .julia/v0.5/
git clone git@gitlab.com:... package_name_without_dotjl

```

---

<div class="post-metadata">

**Author:** ![BVPs](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bvps/32/2190_2.png) [@BVPs](https://discourse.julialang.org/u/BVPs)\
**Post date:** [March 10, 2017, 5:47pm UTC](https://discourse.julialang.org/t/how-to-bypass-username-password-prompt-when-updating-private-packages/2574/6 "2017-03-10T17:47:19Z")

</div>

Thanks, @Tero_Frondelius! However, I still have two problems:  
(1) My private package name on gitlab end with .jl. And, gitlab suggests that I use its ssh as: `git@gitlab.com:myusername/mypackagename.jl.git`. If I omit `.jl.git` part, it fails. On the other hand, if I use that part, the package is cloned, but the generated folder name is `mypackage.jl`. I think this is one of the differences between using `Pkg.clone` and manually running `git clone`. Perhaps, I can rename the folder from `mypackage.jl` to `mypackage` manually once it is cloned. Let me know what you think.  
(2) More seriously, after manually cloning the package, I got the following error when I ran `Pkg.update()`:

```julia
Update finished with errors.
=> Package mypackage.jl cannot be updated.
GitError(Code:ERROR, Class:SSH, Failed to start SSH session: Unable to exchange encryption keys)
 in macro expansion at .\libgit2\error.jl:99 [inlined]
 in #fetch#55(::Base.LibGit2.FetchOptions, ::String, ::Function, ::Base.LibGit2.GitRemote, ::Array{AbstractString,1}) at .\libgit2\remote.jl:70
 in (::Base.LibGit2.#kw##fetch)(::Array{Any,1}, ::Base.LibGit2.#fetch, ::Base.LibGit2.GitRemote, ::Array{AbstractString,1}) at .\<missing>:0
 in #fetch#96(::String, ::String, ::Array{AbstractString,1}, ::Nullable{Base.LibGit2.CachedCredentials}, ::Function, ::Base.LibGit2.GitRepo) at .\libgit2\libgit2.jl:164
 in (::Base.LibGit2.#kw##fetch)(::Array{Any,1}, ::Base.LibGit2.#fetch, ::Base.LibGit2.GitRepo) at .\<missing>:0
 in (::Base.Pkg.Entry.##39#45{CompositeException})(::Base.LibGit2.GitRepo) at .\pkg\entry.jl:426
 in with(::Base.Pkg.Entry.##39#45{CompositeException}, ::Base.LibGit2.GitRepo) at .\libgit2\types.jl:701
 in update(::String, ::Set{String}) at .\pkg\entry.jl:416
 in (::Base.Pkg.Dir.##2#3{Array{Any,1},Base.Pkg.Entry.#update,Tuple{String,Set{String}}})() at .\pkg\dir.jl:31
 in cd(::Base.Pkg.Dir.##2#3{Array{Any,1},Base.Pkg.Entry.#update,Tuple{String,Set{String}}}, ::String) at .\file.jl:48
 in #cd#1(::Array{Any,1}, ::Function, ::Function, ::String, ::Vararg{Any,N}) at .\pkg\dir.jl:31
 in update() at .\pkg\pkg.jl:210
 in include_string(::String, ::String) at .\loading.jl:441
 in eval(::Module, ::Any) at .\boot.jl:234
 in (::Atom.##65#68)() at C:\Users\xxx\.julia\v0.5\Atom\src\eval.jl:40
 in withpath(::Atom.##65#68, ::Void) at C:\Users\xxx\.julia\v0.5\CodeTools\src\utils.jl:30
 in withpath(::Function, ::Void) at C:\Users\xxx\.julia\v0.5\Atom\src\eval.jl:46
 in macro expansion at C:\Users\xxx\.julia\v0.5\Atom\src\eval.jl:109 [inlined]
 in (::Atom.##64#67{Dict{String,Any}})() at .\task.jl:60
 in update(::String, ::Set{String}) at entry.jl:463
 in (::Base.Pkg.Dir.##2#3{Array{Any,1},Base.Pkg.Entry.#update,Tuple{String,Set{String}}})() at dir.jl:31
 in cd(::Base.Pkg.Dir.##2#3{Array{Any,1},Base.Pkg.Entry.#update,Tuple{String,Set{String}}}, ::String) at file.jl:48
 in #cd#1(::Array{Any,1}, ::Function, ::Function, ::String, ::Vararg{Any,N}) at dir.jl:31
 in update() at pkg.jl:210
 in include_string(::String, ::String) at loading.jl:441
 in eval(::Module, ::Any) at boot.jl:234
 in (::Atom.##65#68)() at eval.jl:40
 in withpath(::Atom.##65#68, ::Void) at utils.jl:30
 in withpath(::Function, ::Void) at eval.jl:46
 in macro expansion at eval.jl:109 [inlined]
 in (::Atom.##64#67{Dict{String,Any}})() at task.jl:60

```

What’s wrong here? It said that “Failed to start SSH session”. But when I type `ssh -T git@gitlab.com` on a git-bash terminal, ssh works correctly… Any help is greatly appreciated!

---

<div class="post-metadata">

**Author:** ![Tero\_Frondelius](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tero_frondelius/32/7629_2.png) [@Tero\_Frondelius](https://discourse.julialang.org/u/Tero_Frondelius)\
**Post date:** [March 11, 2017, 6:05am UTC](https://discourse.julialang.org/t/how-to-bypass-username-password-prompt-when-updating-private-packages/2574/7 "2017-03-11T06:05:22Z")

</div>

I don’t have now my work computer, but what I have done is I just used GitLab copy address to clipboard (very similar to GitHub copy address) and pasted it after the command `git clone "copy-paste here" mypackagename` note the last argument of the git command, that is the folder where you want to clone, thus the name without the jl ending. Eventually it’s same if you just rename the folder to remove the jl ending.

Maybe this is related: [Pkg.add() through proxy fails on Julia 0.5, Windows - #14 by pyrex41](https://discourse.julialang.org/t/pkg-add-through-proxy-fails-on-julia-0-5-windows/687/14)

---

<div class="post-metadata">

**Author:** ![BVPs](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bvps/32/2190_2.png) [@BVPs](https://discourse.julialang.org/u/BVPs)\
**Post date:** [March 11, 2017, 5:28pm UTC](https://discourse.julialang.org/t/how-to-bypass-username-password-prompt-when-updating-private-packages/2574/8 "2017-03-11T17:28:17Z")

</div>

@Tero_Frondelius, thank you very much. The first of my question was resolved using your suggestion, e.g., `git clone git@gitlab.com:BoundaryValueProblems/MTSG.jl.git MTSG` Now the folder name is simply `MTSG` without .jl suffix.  
However, my second question, i.e., the error “Failed to start SSH session: Unable to exchange encryption keys”, still occurs whenever I run `Pkg.update()`. Don’t you have the same problem on your windows machine?

---

<div class="post-metadata">

**Author:** ![Tero\_Frondelius](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tero_frondelius/32/7629_2.png) [@Tero\_Frondelius](https://discourse.julialang.org/u/Tero_Frondelius)\
**Post date:** [March 11, 2017, 10:20pm UTC](https://discourse.julialang.org/t/how-to-bypass-username-password-prompt-when-updating-private-packages/2574/9 "2017-03-11T22:20:14Z")

</div>

Maybe I really haven’t had your use case before. I propose you will try `git pull` before your `Pkg.update()`. Please try also with the julia version 0.5.1, maybe the problem is fixed already.

---

<div class="post-metadata">

**Author:** ![BVPs](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bvps/32/2190_2.png) [@BVPs](https://discourse.julialang.org/u/BVPs)\
**Post date:** [March 12, 2017, 7:39pm UTC](https://discourse.julialang.org/t/how-to-bypass-username-password-prompt-when-updating-private-packages/2574/10 "2017-03-12T19:39:48Z")

</div>

Hi, @Tero_Frondelius. I have been using julia v0.5.1 for a week or so. All the errors I reported were from 0.5.1. I also just ran `git pull` manually in the package folder, which said: `Already up-to-date`, as I expected. Then, on my julia sesstion, I ran `Pkg.update()`, which resulted in exactly the same error: `"Failed to start SSH session: Unable to exchange encryption keys`.
