# Help! Pkg.add from company's Bitbucket repository fails due to SSH authentication

**URL:** https://discourse.julialang.org/t/help-pkg-add-from-companys-bitbucket-repository-fails-due-to-ssh-authentication/33897
**Category:** New to Julia
**Tags:** ssh
**Created:** [January 28, 2020, 6:07pm UTC](https://discourse.julialang.org/t/help-pkg-add-from-companys-bitbucket-repository-fails-due-to-ssh-authentication/33897 "2020-01-28T18:07:05Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![Zhong\_Pan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zhong_pan/32/19872_2.png) [@Zhong\_Pan](https://discourse.julialang.org/u/Zhong_Pan)
#### Post date: [January 28, 2020, 7:41pm UTC](https://discourse.julialang.org/t/help-pkg-add-from-companys-bitbucket-repository-fails-due-to-ssh-authentication/33897/3 "2020-01-28T19:41:45Z")

</div>

@Pbellive Thank you for pointing me to the thread! After trying various combinations suggested by the replies and having a little “aha” moment of my own, I found the following workaround for Windows 10 with Julia 1.3.1:

(1) Regenerate the SSH key using the “-m PEM” option. In my case, the command line is:  
`ssh-keygen -t rsa -m PEM -C zpan@mycompany.com`

Update the public key submitted to the private git server with the new key. Confirm that “git pull” can work.

(2) Create two system environmental variables:

```julia
SSH_KEY_PATH = C:/Users/zpan/.ssh/id_rsa
SSH_PUB_KEY_PATH = C:/Users/zpan/.ssh/id_rsa.pub

```

Alternatively, these also work:

```julia
SSH_KEY_PATH = C:\\Users\\zpan\\.ssh\\id_rsa
SSH_PUB_KEY_PATH = C:\\Users/zpan\\.ssh\\id_rsa.pub

```

Note the double backslash `\\`.

With these all set up, one can start a Julia session and add the package. There will be no prompt for the private key location and it would just work:

```julia
(v1.3) pkg> add ssh://git@bitbucket.mycompany.com:7999/opdt/mypackage.jl.git
  Updating registry at `C:\Users\zpan\.julia\registries\General`
  Updating git-repo `https://github.com/JuliaRegistries/General.git`
  Updating git-repo `ssh://git@bitbucket.mycompany.com:7999/opdt/mypackage.jl.git`
  Updating git-repo `ssh://git@bitbucket.mycompany.com:7999/opdt/mypackage.jl.git`
 Resolving package versions...
  Updating `C:\Users\zpan\.julia\environments\v1.3\Project.toml`
  [045fb6ed] + mypackage v0.1.0 #master (ssh://git@bitbucket.mycompany.com:7999/opdt/mypackage.jl.git)
  Updating `C:\Users\zpan\.julia\environments\v1.3\Manifest.toml`
  [045fb6ed] + mypackage v0.1.0 #master (ssh://git@bitbucket.mycompany.com:7999/opdt/mypackage.jl.git)

```

What didn’t work for me:

1. Typing in the path or accepting default when Pkg.add prompts for the private key location. I tried every format to no avail.
2. Using single backslash `\` (e.g. `C:\Users\zpan\.ssh\id_rsa`), or using the drive letter without : (e.g. `/C/Users/zpan/.ssh/id_rsa`) in the environmental variables.

I will post link to this Windows workaround to the relevant threads, too.

---

_[View the full topic](https://discourse.julialang.org/t/help-pkg-add-from-companys-bitbucket-repository-fails-due-to-ssh-authentication/33897)._
