How to bypass username/password prompt when updating private packages

I have some private packages on, and just added one of them via Pkg.clone(""). Now, it set things up correctly, but whenever I run Pkg.update(), julia asks me my username and password on, 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()?

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

ERROR: ArgumentError: drive mismatch: METADATA
 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.

In Windows 7, I have used git bash:

@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("") produced the error as I reported.

cd .julia/v0.5/
git clone package_name_without_dotjl

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: 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():

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 on a git-bash terminal, ssh works correctly… Any help is greatly appreciated!

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

@Tero_Frondelius, thank you very much. The first of my question was resolved using your suggestion, e.g., git clone 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?

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.

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.