UnityAutoIncrementBuildVersion
UnityAutoIncrementBuildVersion copied to clipboard
SSH can't connect during cloud build
I'm trying to run this on cloud build, and it seems like everything is set up with the keys (the code checks out fine, tests run and a build a created), however, when it tries to run the commit.sh
, I get errors about Host key verification failed.
. That seems to mean that the script can't get access to the key stored on cloud build.
To get the error, I ran:
ssh -T [email protected]
Host key verification failed.
How did you get it work?
Hey, in the script, you should be able to set your ssh key that will be used with github. I'm gonna check this out for you today. This should be fine, given that it also clones with the same key. Maybe you just need to give it writing permissions in github?
We have set the permissions in github to be read/write.
It seems really weird. I'm trying to find the ssh key it's using but it seems like ls -lav ~/.ssh
is empty. I'm wondering if I have to add the key manually.
Ok, so it seems the build process may have changed (another server clones the repo and then sends it off to the builder). I'm gonna have to figure out an easy way to do this, thinking about setting the key in the commit.sh file. Feel free to mess around with it - I probably won't get to it until end next week. Really sorry for the inconvenience.
Okay, this should work:
- Generate a new key in the same directory as commit.sh called "deploy"
- Add the "deploy" key as a deploy key
- Update your commit.sh script with this one https://github.com/PimDeWitte/UnityAutoIncrementBuildVersion/blob/master/commit.sh
I haven't tested it yet, let me know if it works.
Actually, before you do that, just add:
ssh-keyscan -H github.com >> ~/.ssh/known_hosts
to the commit.sh file and see if it works
Nope, I tried just
ssh-keyscan -H github.com >> ~/.ssh/known_hosts
and I still get the error
6780: [Unity] Permission denied (publickey).
6781: [Unity] fatal: Could not read from remote repository.
6782: [Unity] Please make sure you have the correct access rights
6783: [Unity] and the repository exists.
Will try the other thing. Thanks!
Oh, adding the deploy key into the repo (albeit private) is pretty risky. Don't think I want to do that.
Going to try and think of a better way...
I've contacted cloud build support to see if they have any other solutions.
Yeah that's probably a good idea. Let me know what they say.
I'm gonna try to mess around with this:
https://gist.github.com/testcollab/1236348/8ebe7df22fef7e695b2835614aaeea0114a3477d
And just make cloud build it's own account
It's been a while, but did you ever come up with a solution to this problem?
I have the same problem even after I use known_hosts
, have you found a solution for this?
This is works for me, try to do:
chown $USER <path to known hosts>