Github Actions: xcodebuild fails due to server fingerprint

Finally I figured it out. It seems like its a known issue in Xcode 11 (https://developer.apple.com/documentation/xcode_release_notes/xcode_11_release_notes).

Thanks to Dosium in this post (https://discuss.bitrise.io/t/xcode-11-resolving-packages-fails-with-ssh-fingerprint/10388), I was able to get it work.

The solution is to run the following command before running xcodebuild: for ip in $(dig @8.8.8.8 github.com +short); do ssh-keyscan github.com,$ip; ssh-keyscan $ip; done 2>/dev/null >> ~/.ssh/known_hosts


TS asked for a problem with dependency on private repository, but just in case there're some people who ran into this problem for a public repository dependency, make sure that you're using HTTPS instead of SSH for that dependency repository address.

Example:

https://github.com/Alamofire/Alamofire.git

instead of

[email protected]:Alamofire/Alamofire.git

For CircleCI:

Adding onto Yakuhzi's answer, here's what the step looks like in Circle Ci's yaml file:

- run:
    name: Enable SSH
    command: |
       for ip in $(dig @8.8.8.8 github.com +short); do ssh-keyscan github.com,$ip; ssh-keyscan $ip; done 2>/dev/null >> ~/.ssh/known_hosts