tgstation-server
tgstation-server copied to clipboard
You shouldn't need a public key to enable pushing changelogs
The public key is already encoded in the private key, and I was able to git the git client to work without it.
upstream bugreport: libgit2/libgit2sharp#1468 upstream bugreport: libgit2/libgit2#4289
I don't even have a public key file for the tgstation-server account, and I don't even know how to generate one (i bet it isn't hard, but i'm just not going to now out of principle)
you 'git' it to do it did you? ;P
That was intentional
as was "now and days" and "rather it happens" I assume :^)
Sadly, there's no function in the c# api to generate the public key from the private key. Git must have something else built in. However, you can generate it yourself using puttygen https://askubuntu.com/a/700275
A quick look into this shows that there's no way for us to generate it in code without importing another crypto library alongside what LibGit2Sharp ships and that's not something I'm a fan of when the above solution works perfectly.
Why do you need it?
The issue lies in this function called from libgit2: https://www.libssh2.org/libssh2_userauth_publickey_fromfile_ex.html. Apparently the shipped libssh2 version doesn't include OpenSSL support because it will always fail without the public key
why are we using an ssh library that is so out of active development its issue tracker has had spam on it for 4 months: http://trac.libssh2.org/ticket/310
And its last actual activity is over a year ago.
Also. I needed to you explain the top level function you are calling that requires it, I was planning on doing the investigation you did.
Still need that.
The credentials are created here: https://github.com/tgstation/tgstation-server/blob/master/TGServerService/Repository.cs#L745
Those map to a simple data holder in LibGit2Sharp which forwards them to the credentials provider: https://github.com/leobuskin/libgit2sharp-ssh/commit/bec6d39617faaebcbab5af0e2803a012b1bfd04d#diff-4df0bf63109ae12623c2accde500d8f8R16
That calls git_cred_ssh_key_new which in turn calls libssh2_userauth_public_key_fromfile_ex: https://github.com/libgit2/libgit2/blob/7849e467579f64ccbbfdc4463af97a215d1ac8e3/src/transports/ssh.c#L356
Was too stupid back then to realize you could use a remote similar to git://<user>:<token>@github.com/<owner>/<repo>
to make this work. Fixed in V4 anyways.