Glavin001/GitLab-Pages

Problem with SSH key.

fbertux opened this issue · 9 comments

Hi!
I'm trying to run Gitlab Pages but Gitlab Pages always crash. I followed the steps on Readme. I can open Gitlab Pages web page with my private token and select the project. When I clicked on Enable, the deploy key and a web hook is created on Gitlab. I'm running Gitlab on address 192.168.1.1:10081 and Gitlab Pages is on 192.168.1.1:3000. The variable publicUrl is set to 192.168.1.1:3000. When I push gl-pages branch to gitlab the server npm stop and I get the error:

/home/docker/GitLab-Pages/node_modules/nodegit/node_modules/nodegit-promise/node_modules/asap/asap.js:45
                throw e;
                      ^
Error: Failed to authenticate SSH session: Username/PublicKey combination invalid
npm ERR! weird error 8
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian

SSH key was created like described on README.
If I click on project that I Enabled on Gitlab Pages web page I get this error:

Error: Not Found
    at app.use.res.render.message (/home/docker/GitLab-Pages/app.js:56:15)
    at Layer.handle [as handle_request] (/home/docker/GitLab-Pages/node_modules/express/lib/router/layer.js:82:5)
    at trim_prefix (/home/docker/GitLab-Pages/node_modules/express/lib/router/index.js:302:13)
    at /home/docker/GitLab-Pages/node_modules/express/lib/router/index.js:270:7
    at Function.proto.process_params (/home/docker/GitLab-Pages/node_modules/express/lib/router/index.js:321:12)
    at next (/home/docker/GitLab-Pages/node_modules/express/lib/router/index.js:261:10)
    at SendStream.error (/home/docker/GitLab-Pages/node_modules/express/node_modules/serve-static/index.js:107:7)
    at SendStream.EventEmitter.emit (events.js:95:17)
    at SendStream.error (/home/docker/GitLab-Pages/node_modules/express/node_modules/send/index.js:244:17)
    at SendStream.onStatError (/home/docker/GitLab-Pages/node_modules/express/node_modules/send/index.js:340:48)

I'm little confused about setting, Is missing something? Gitlab version is 7.8.4.

npm WARN This failure might be due to the use of legacy binary "node"

What version of Node do you have?

Version v0.10.25

I hope to switch off of nodegit to the more supported jsgit ( see #11 ). That should resolve this. However I currently do not have the time to make those and a few other changes.

As always, I accept pull requests to merge, and hopefully I will have time later in these next two weeks to take a look at it myself if no one submits any PRs.

Update: There are a few applicable results when searching for Error: Failed to authenticate SSH session: Username/PublicKey combination invalid
See https://www.google.ca/search?q=Error%3A+Failed+to+authenticate+SSH+session%3A+Username%2FPublicKey+combination+invalid&oq=Error%3A+Failed+to+authenticate+SSH+session%3A+Username%2FPublicKey+combination+invalid&aqs=chrome..69i57j69i58.534j0j7&sourceid=chrome&es_sm=119&ie=UTF-8
Maybe something there will help

If I click on project that I Enabled on Gitlab Pages web page I get this error:
Error: Not Found

Note: If it did not correctly clone (sounds like that is failing in part 1 of this issue) then these routes will not resolve and you will of course see 404 error.

Ok. I'll try to use jsgit and if I can't make work I'll open a PR.
Thanks!

Merging this into issue #11 and closing this issue. Once #11 is complete this should be all good 👍.

No longer going to be using jsgit. Nodegit is more actively maintained.

Hello,

where have you placed your ssh keys?

Have you tried to 'git clone' the repo, using these keys, from a shell?
It could just that gitlabpages is not picking up the right keys? or keys do not have permissions?

If I understand correct, if you use real deploy keys, they shoyld be added to every other project? (you can't add users global deploy key)

The deploy keys should be automatically added when you click Enable.

See https://github.com/Glavin001/GitLab-Pages/blob/master/default_config.js#L11-L18

 /**
        SSH Public Key for Project Deploy Key
        */
        sshPublicKey: path.resolve("./keys/id_rsa.pub"),
        /**
        SSH Private Key for Project Deploy Key
        */
        sshPrivateKey: path.resolve("./keys/id_rsa"),

They should be placed in the keys directory and named id_rsa.pub and id_rsa, although you can simply change your config file to indicate any location you want.

Failed to authenticate SSH session: Username/PublicKey combination invalid

Upon reviewing the error message it sounds like the SSH deploy keys were not setup properly. I was not experiencing this issue before or now with the latest GitLab Pages, with updated nodegit. I would recommend updating and trying again. I am going to try and improve the documentation and/or make the setup process more automated.

If you were still unable to get it to work, please let me know and we can reopen this issue. Thanks.