# Prepare self-hosted runner on Windows 10 for Github Actions and Julia private registry and packages

**URL:** <https://discourse.julialang.org/t/prepare-self-hosted-runner-on-windows-10-for-github-actions-and-julia-private-registry-and-packages/82367>\
**Category:** General Usage\
**Tags:** windows, github, github-actions\
**Created:** [June 7, 2022, 12:18pm UTC](https://discourse.julialang.org/t/prepare-self-hosted-runner-on-windows-10-for-github-actions-and-julia-private-registry-and-packages/82367 "2022-06-07T12:18:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sairus7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sairus7/32/10816_2.png) [@sairus7](https://discourse.julialang.org/u/sairus7)\
**Post date:** [June 7, 2022, 12:18pm UTC](https://discourse.julialang.org/t/prepare-self-hosted-runner-on-windows-10-for-github-actions-and-julia-private-registry-and-packages/82367/1 "2022-06-07T12:18:01Z")

</div>

Leaving this here just as an instruction for others.

I’ve tried to add Windows self-hosted runner to build and test my private package and got the following error:

```julia
> Run julia-actions/add-julia-registry@v1
C:\Windows\System32\OpenSSH\ssh-agent.exe
C:\Windows\System32\OpenSSH\ssh-add.exe C:\Windows\SERVIC~1\NETWOR~1\AppData\Local\Temp\tmp-6200-o7Pm6fzViZyY
Error connecting to agent: No such file or directory
Error: The process 'C:\Windows\System32\OpenSSH\ssh-add.exe' failed with exit code 2
    at ExecState._setResult (C:\actions-runner\_work\_actions\julia-actions\add-julia-registry\v1\node_modules\@actions\exec\lib\toolrunner.js:592:25)
    at ExecState.CheckComplete (C:\actions-runner\_work\_actions\julia-actions\add-julia-registry\v1\node_modules\@actions\exec\lib\toolrunner.js:575:18)
    at ChildProcess.<anonymous> (C:\actions-runner\_work\_actions\julia-actions\add-julia-registry\v1\node_modules\@actions\exec\lib\toolrunner.js:469:27)
    at ChildProcess.emit (events.js:314:20)
    at maybeClose (internal/child_process.js:1022:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)

```

How did I fix this:

- Install Git for Windows

```julia
winget install --id Git.Git -e --source winget

```

- Add to PATH: `C:\Program Files\Git\usr\bin`
- Move it before `C:\Windows\System32\OpenSSH` entry (unconfirmed if this is necessary)
- Add to PATH : `C:\Program Files\Git\bin\git.exe`, `C:\Program Files\Git\cmd`
- Restart ssh-agent service:

```julia
Stop-Service ssh-agent
Start-Service ssh-agent

```

- Restart actions runner service:

```julia
Stop-Service "actions.runner.*"
Start-Service "actions.runner.*"

```

- Then I got error in `julia-actions/julia-buildpkg@v1` action that could not download deps from private registry:

```julia
Cloning [b2dd10be-c0b5-41fc-bf7d-fdb86be5b335] MyPrivatePackage from git@github.com:MyOrg/MyPrivatePackage.jl 
ERROR: failed to clone from git@github.com:MyOrg/MyPrivatePackage.jl, 
error: GitError(Code:EUSER, Class:Callback, Aborting, user cancelled credential request.)

```

Solved it by adding environment variable in my workflow file:

```julia
env: 
  JULIA_PKG_USE_CLI_GIT: true

```

> **FYI, this is the full workflow file for my project**
>
> ```yaml
> name: testbuild
> 
> on:
> push:
> branches: [master]
> pull_request:
> branches: [master]
> 
> env:
> PYTHON: ""
> JULIA_PKG_USE_CLI_GIT: true
> 
> jobs:
> test:
> runs-on: [self-hosted, '${{ matrix.os }}', '${{ matrix.arch }}']
> strategy:
> matrix:
> julia-version: ['1.7.2']
> arch: [x64]
> os: [Windows]
>     
> steps:
> - uses: webfactory/ssh-agent@v0.5.1
> with:
> ssh-private-key: ${{ secrets.MY_SSH_PRIVATE_GHA_KEY }}
> - uses: actions/checkout@v2
> - uses: julia-actions/add-julia-registry@v1
> with:
> key: ${{ secrets.MY_SSH_PRIVATE_GHA_KEY }}
> registry: IncartDev/JuliaRegistry
> - uses: julia-actions/setup-julia@v1
> with:
> version: ${{ matrix.julia-version }}
> arch: ${{ matrix.arch }}
> - uses: julia-actions/julia-buildpkg@v1
> - uses: julia-actions/julia-runtest@v1
> 
> ```
