Git plugin not authenticating

Started by GregTheHun, June 25, 2021, 09:02:40 PM

Previous topic - Next topic
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:



Then it gives me this error:



Any help would be much appreciated.

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?

The password based authentication method seems to be deprecated anyway:

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


Took out the password, same result

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?

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.

July 04, 2021, 12:02:04 AM #7 Last Edit: July 04, 2021, 12:09:30 AM by Greelan
Try setting the username as "git" (don't include the quote marks). No password, just the SSH key.

Also, is the repo currently empty?

Alrighty, both of those suggestions made it work.

So, for anyone else:

  • Setup SSH Keys properly (With your ssh-agent too)
  • Make sure it works on Github
  • Create a new repo (don't add or commit anything)
  • The URL should be ssh://github.com/[username]/[repo].git
  • The branch should be whichever one is the one setup (most likely master)
  • Paste your SSH key
  • Set username to 'git'
  • Success! :-D


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)