OPNsense Forum

English Forums => General Discussion => Topic started by: GregTheHun on June 25, 2021, 09:02:40 PM

Title: Git plugin not authenticating
Post by: GregTheHun on June 25, 2021, 09:02:40 PM
Hello all,

I love OpnSense and it has been great ever since I installed it. However...

My only problem now that I can't seem to solve intuitively is I want auto backups of my config to github. I think I have my settings correct:

(https://i.ibb.co/bsmpV2K/1.png)

Then it gives me this error:

(https://i.ibb.co/yWJvJGf/2.png)

Any help would be much appreciated.
Title: Re: Git plugin not authenticating
Post by: Greelan on June 27, 2021, 03:00:28 AM
I don't use git backups personally, but aren't key auth and user/password auth alternatives? That is, you specify one or the other but not both?
Title: Re: Git plugin not authenticating
Post by: Sheldon on June 28, 2021, 01:02:12 PM
The password based authentication method seems to be deprecated anyway:

https://forum.opnsense.org/index.php?topic=23232
Title: Re: Git plugin not authenticating
Post by: franco on June 29, 2021, 07:40:12 AM
Quote from: Sheldon on June 28, 2021, 01:02:12 PM
The password based authentication method seems to be deprecated anyway:

https://forum.opnsense.org/index.php?topic=23232

For GitHub...
Title: Re: Git plugin not authenticating
Post by: GregTheHun on June 30, 2021, 01:28:38 AM
Took out the password, same result
Title: Re: Git plugin not authenticating
Post by: Sheldon on July 03, 2021, 07:56:31 AM
I took a look into the source code of the plugin. The error message you got ("authentication failure") is displayed in more than one use case.


https://github.com/opnsense/plugins/blob/master/sysutils/git-backup/src/opnsense/mvc/app/library/OPNsense/Backup/Git.php



} elseif (strpos($pushtxt, 'Permission denied') || strpos($pushtxt, 'Authentication failed ')) {
            $error_type = "authentication failure";


Personally i don't use Github, but i have used a similar service provider. I assume that you have registered your SSH key with your Github account ("GregTheHun"). But have you also linked this key with the repository ("opnsense-config") and granted full (read/write) permissions?
Title: Re: Git plugin not authenticating
Post by: GregTheHun on July 03, 2021, 03:20:43 PM
Yes, I do have the ssh key added, and it does work for other repos.

Just not the new one I setup for the configs, but at least I remember creating new ones for each of my projects and not coming across this yet.

I'll have to check and see if something's different on the others.
Title: Git plugin not authenticating
Post by: Greelan on July 04, 2021, 12:02:04 AM
Try setting the username as "git" (don't include the quote marks). No password, just the SSH key.

Also, is the repo currently empty?
Title: Re: Git plugin not authenticating
Post by: GregTheHun on July 04, 2021, 12:59:48 AM
Alrighty, both of those suggestions made it work.

So, for anyone else:
Title: Re: Git plugin not authenticating
Post by: Greelan on July 04, 2021, 01:02:43 AM
Excellent.

I just took some hints from the docs: https://docs.opnsense.org/manual/git-backup.html
Title: Re: Git plugin not authenticating
Post by: Mombro on March 13, 2025, 07:07:30 PM
Hi,

this is 2025 replying. I just wanted to say: I did everything as described above, but it did not work. I read the mentioned docs and found this:

Next, create a new SSH key specifically for git-backup (only generate the private / public keys per that document and skip the rest). It is imperative that you do not add a password to your key, or your backups will fail with authentication errors.


Well, what shall I say ... now it works ... Just don't set a password for the SSH key (man, how would opnsense know the password anyway, yuk)