Github - How to clone/install specific branch?

Hey guys!

I started using Github for my package (GitHub - AhmedSalih3d/PostSPH.jl: Easing the process of post-processing simulations done in DualSPHysics) and I have two different branches, “master” and “dev”. If I do the command to install the package like this:


It works, but say I want a specific branch ie. “dev”:

   Cloning git-repo ``
ERROR: failed to clone from, error: GitError(Code:ERROR, Class:Net, request failed with status code: 404)

I assume the 404 error is “not found”, but how do I then do?

Kind regards

1 Like



can’t test it right now.


It works, thanks!

What if I want to use git instead of https?

I don’t know but perhaps it’s obsolete:


I would suspect they mean they want to use ssh rather than https, as in

1 Like

Yes. That’s what I meant.

I played it through with the following outcome.
Sources to follow on how to make it work:

First attempt:

(@v1.8) pkg> add ""
     Cloning git-repo ``
SSH host verification: the identity of the server `` does not 
match its known hosts record. Someone could be trying to man-in-the-middle
your connection. It is also possible that the server has changed its key, in
which case you should check with the server administrator and if they
confirm that the key has been changed, update your known hosts file.
ERROR: failed to clone from, 
error: GitError(Code:ERROR, Class:Net, user cancelled hostkey check)

I had to set a environment variable before running Julia REPL, this maybe not the case for everyone:


E.g. for windows this can be done in the CMD where Julia REPL is started later:


I am on Julia 1.8.2 perhaps some day in future this is not needed anymore.

Now setting up ssh keys as described in above github documentation.

I did the key generation in a Linux shell. As I want to use it on Windows, I had to convert it into ppk format, using “PuTTY Key Generator” (menu Conversions) and saving it as .ppk.
The PuTTY version of ssh-agent is Pageant, where I imported the .ppk key.

Now next attempt:

(@v1.8) pkg> add ""
     Cloning git-repo ``
    Updating git-repo ``
    Updating registry at `C:\Users\oheil\.julia\registries\General`
    Updating git-repo ``
  1 dependency successfully precompiled in 5 seconds. 335 already precompiled.

To get to a specific tagged version of this project you can do now:

(@v1.8) pkg> add NormalizeQuantiles#offset-arrays
    Updating git-repo ``
   Resolving package versions...
    Updating `C:\Users\oheil\.julia\environments\v1.8\Project.toml`
  [d366530f] ~ NormalizeQuantiles v1.2.2 `` ⇒ v1.0.0 ``
    Updating `C:\Users\oheil\.julia\environments\v1.8\Manifest.toml`
  [d366530f] ~ NormalizeQuantiles v1.2.2 `` ⇒ v1.0.0 ``
Precompiling project...
  1 dependency successfully precompiled in 3 seconds. 335 already precompiled.

Well, successful, except not as convenient as the https protocol :wink:

See Julia v1.6.0-rc1 and SSH host verification for another work around, but keep in mind of the warning by StefanKarpinski.

1 Like

Actually the accepted solution didn’t work for me it strangely always installs main, but this instead works

Pkg.add(url = "", rev = "branch_name")