Private Repositories bug
See original GitHub issueBug description
I am trying to build my Unity Project to Android using the GameCI. My project uses private repositories with ssh. I follow the documentation and I put the SSH Agent step in my CI. I add the Deploy Key to my repository and add the secret key to Secrets.
But this error occurs:
com.company.utils: Error when executing git command. Failed to add the RSA host key for IP address '140.82.112.3' to the list of known hosts (/root/.ssh/known_hosts).
ERROR: Repository not found.
fatal: Could not read from remote repository.
I already try to add the ips in /home/runner/.ssh/known_hosts. The command below does not return errors:
Run ssh-keyscan 140.82.114.3 >> /home/runner/.ssh/known_hosts
ssh-keyscan 140.82.114.3 >> /home/runner/.ssh/known_hosts
shell: /usr/bin/bash -e {0}
env:
SSH_AUTH_SOCK: /tmp/ssh-BYQRT89SNPb3/agent.1664
SSH_AGENT_PID: 1665
# 140.82.114.3:22 SSH-2.0-babeld-968490c5
# 140.82.114.3:22 SSH-2.0-babeld-968490c5
# 140.82.114.3:22 SSH-2.0-babeld-968490c5
# 140.82.114.3:22 SSH-2.0-babeld-968490c5
# 140.82.114.3:22 SSH-2.0-babeld-968490c5
When I try to add to /root/.ssh/known_hosts, the error occurs:
Run ssh-keyscan github.com >> /root/.ssh/known_hosts
ssh-keyscan github.com >> /root/.ssh/known_hosts
shell: /usr/bin/bash -e {0}
env:
SSH_AUTH_SOCK: /tmp/ssh-3ZIaGpOiiIJn/agent.1641
SSH_AGENT_PID: 1642
/home/runner/work/_temp/8d9c2b71-d5e1-4648-b27e-5f695d8e3558.sh: line 1: /root/.ssh/known_hosts: Permission denied
Error: Process completed with exit code 1.
How to reproduce
-
Create a unity project that uses private repositories with ssh
-
Try to run CI Unity Build
Expected behavior
Build the project with success
CI File
name: Actions 😎
on: [push, pull_request]
jobs:
build:
name: Build Project ✨ for ${{ matrix.targetPlatform }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
projectPath:
- xproject-unity
unityVersion:
- 2020.3.11f1
targetPlatform:
- Android
steps:
# Checkout
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: SSH Agent
uses: webfactory/ssh-agent@v0.5.3
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Adding github to known_hosts
run: ssh-keyscan github.com >> /root/.ssh/known_hosts
- name: Adding github to known_hosts
run: ssh-keyscan 140.82.114.3 >> /root/.ssh/known_hosts
- name: Adding github to known_hosts
run: ssh-keyscan 140.82.114.4 >> /root/.ssh/known_hosts
# Cache
- uses: actions/cache@v2
with:
path: ${{ matrix.projectPath }}/Library
key: Library-${{ matrix.targetPlatform }}
restore-keys: |
Library-${{ matrix.targetPlatform }}-
Library-
# Build
- name: Build project
uses: game-ci/unity-builder@v2
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
with:
sshAgent: ${{ env.SSH_AUTH_SOCK }}
projectPath: ${{ matrix.projectPath }}
unityVersion: ${{ matrix.unityVersion }}
targetPlatform: ${{ matrix.targetPlatform }}
versioning: Semantic
androidAppBundle: false
androidKeystoreName: x.keystore
androidKeystoreBase64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}
androidKeystorePass: ${{ secrets.ANDROID_KEYSTORE_PASS }}
androidKeyaliasName: ${{ secrets.ANDROID_KEYALIAS_NAME }}
androidKeyaliasPass: ${{ secrets.ANDROID_KEYALIAS_PASS }}
# Output
- uses: actions/upload-artifact@v2
with:
name: Build-${{ matrix.targetPlatform }}
path: build/${{ matrix.targetPlatform }}
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:18 (8 by maintainers)
Top Results From Across the Web
Private repositories on github are not detected · Issue #129758
Issue Type: Bug Cloning a private repository does not work: Only public repositories are available in the dropdown...private repos don't ...
Read more >How to have a private repository with public issue tracker on ...
Project is stored on GitHub in the private repository. I would like to allow this community to report bugs and place them directly...
Read more >Incident Report: Inadvertent Private Repository Disclosure
On Thursday, October 20th, a bug in GitHub's system exposed a small amount of user data via Git pulls and clones. In total,...
Read more >Public key not displayed on theme component install from ...
When I try to add a theme component from a private repository, the generated public key is not ... That certainly sounds like...
Read more >Private Repositories - Declarative GitOps CD for Kubernetes
This is indicated by an error message such as x509: certificate signed by unknown authority . You can let ArgoCD connect the repository...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If you have access to
sudo
, maybe you can try| sudo tee -a
like this:I just confirmed that this fixes the permission issue you’re getting:
https://github.com/GabLeRoux/283-private-repositories/pull/1/files
Before the fix:
After the fix:
🚀
ip is
140.82.112.4
in above error message, but the ones you are adding here are different:I know they’re close, but there’s a small difference:
140.82.114.3 140.82.114.4 140.82.112.4 <-- the ip from your error
😉
Try also adding this maybe?