Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Git plugin not working #5

Closed
jalberto opened this issue Dec 1, 2020 · 19 comments
Closed

Git plugin not working #5

jalberto opened this issue Dec 1, 2020 · 19 comments

Comments

@jalberto
Copy link

jalberto commented Dec 1, 2020

Similar to other flatpack pkg like flathub/com.visualstudio.code#23

upstream issue: Vinzent03/obsidian-git#22

@joshua-stone
Copy link
Collaborator

@jalberto I've updated the flatpak to use ssh-auth. Please update as such:

$ flatpak update md.obsidian.Obsidian
$ flatpak override --reset md.obsidian.Obsidian
$ flatpak run md.obsidian.Obsidian

Does the latest update address this issue, or is there more that needs to be done?

@jalberto
Copy link
Author

jalberto commented Dec 3, 2020

thanks @joshua-stone

Looks like is not yet published in flathub

@joshua-stone
Copy link
Collaborator

@jalberto Has the permission not been updated yet when checking info?

$ flatpak info --show-permissions md.obsidian.Obsidian
[Context]
shared=network;ipc;
sockets=x11;pulseaudio;ssh-auth;
devices=dri;
filesystems=home;/media;/mnt;/run/media;

@jalberto
Copy link
Author

jalberto commented Dec 3, 2020

The issue is the package has not been updated yet, still in the previous version

$ flatpak update md.obsidian.Obsidian
Looking for updates…
Nothing to do.

@joshua-stone
Copy link
Collaborator

@jalberto I've republished the build. Does it update now?

@jalberto
Copy link
Author

jalberto commented Dec 4, 2020

yes! thanks :)

now the issue is:

Are you sure you want to continue connecting (yes/no/[fingerprint])?

so if Obsidian is not run in the console it's impossible to answer that question as it seems unavailable to find ssh-askpass

@joshua-stone
Copy link
Collaborator

Can you describe how it's supposed to behave normally, or how it behaves in the AppImage and/or snap?

If the git plugin is verifying with a brand new host, then I'd hope the git plugin maintainer has provided a built-in mechanism like a confirmation dialog to confirm so Obsidian itself doesn't need to be run from a console. If the git plugin in the flatpak is asking to verify with a previously-verified host yet the AppImage and/or snap don't, then that sounds like a bug unique to the flatpak.

@jalberto
Copy link
Author

jalberto commented Dec 4, 2020

what I can see from the logs is that is trying to run ssh-askpass but cannot find it because is outside flatpak, VSC solve this by including its own ssh-askpass.

I just tried the appimage version and it works out of the box (I have not snap in my system)

@Erick555
Copy link

Erick555 commented Dec 4, 2020

@jalberto does /run/user/<UID>/ssh-auth socket exist before you launch obsidian flatpak?

Additionally if you do flatpak run --persist=.ssh md.obsidian.Obsidian it shouldn't ask you to confirm host authenticity each time.

@joshua-stone
Copy link
Collaborator

@jalberto Is there an example repo I can experiment with to test fixes to this bug? I haven't had the time to set up the git plugin.

@jalberto
Copy link
Author

jalberto commented Dec 4, 2020

@joshua-stone without the git-plugin there is not issues, to replicate this you need to install the plugin (using obsidian settings) and initialize a git repo in your obsidian directory. As soon there is a .git in the obsidian vault the plugin will try to pull/push

using --persist=.ssh doesn't make a difference

@Erick555 ssh-auth doesn't' exist, even after running 'ssh-add' or 'ssh-agent' manually

As it seems to work as expected in Appimage I wonder if this is related to isolation and the correct combination or permission is required

@joshua-stone
Copy link
Collaborator

@jalberto Can you specify more information about the distribution version you're using when running the flatpak and appimage, and whether you're using password authentication and/or key authentication?

I'm running this on Fedora 33, and am having trouble reproducing this behavior. Here's how the git config for my test vault looks:

$ cat obsidian-docs/.git/config 
[core]
	repositoryformatversion = 0
	filemode = true
	bare = false
	logallrefupdates = true
[remote "origin"]
	url = git@github.com:joshua-stone/obsidian-docs
	fetch = +refs/heads/*:refs/remotes/origin/*
[branch "main"]
	remote = origin
	merge = refs/heads/main

I can confirm that it does ask for verifying a fingerprint the first time when doing a push. Subsequent runs don't have this issue though, even if launching from the app menu instead of command line afterward:

[jstone@localhost]$ flatpak run md.obsidian.Obsidian 
Gtk-Message: 12:20:16.345: Failed to load module "canberra-gtk-module"
Gtk-Message: 12:20:16.345: Failed to load module "pk-gtk-module"
Gtk-Message: 12:20:16.345: Failed to load module "canberra-gtk-module"
Gtk-Message: 12:20:16.345: Failed to load module "pk-gtk-module"
2020-12-04 17:20:16 Loading main app package /app/resources/obsidian.asar
Updates disabled.

The authenticity of host 'github.com (140.82.114.3)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes

And to confirm that ssh-auth creates the known_hosts file needed for subsequent pushes. Before:

$ find ~/.ssh
/home/jstone/.ssh
/home/jstone/.ssh/id_rsa
/home/jstone/.ssh/id_rsa.pub
/home/jstone/.ssh/known_hosts.bak

After:

$ find ~/.ssh
/home/jstone/.ssh
/home/jstone/.ssh/id_rsa
/home/jstone/.ssh/id_rsa.pub
/home/jstone/.ssh/known_hosts.bak
/home/jstone/.ssh/known_hosts

@jalberto
Copy link
Author

jalberto commented Dec 4, 2020

@joshua-stone really appreciate the time you are taking to reproduce this :)

I am on Fedora 33 too, and my git config is mostly the same as yours, but using GitLab here (private repository). I am using key authentication protected with a password.
I have others repos in gitlab.com so is even more annoying

I only have this issue with obsidian repo using the flatpack package.

  • using git cli in obsidian vault has not issues
  • using appimage works

this happens when run twice in a row (last 2 lines if after clicking "close" button in obsidian)

image

@jalberto
Copy link
Author

jalberto commented Dec 4, 2020

I made it work by using --filesystem=~/.ssh but I don't know if this is recommended

@Erick555
Copy link

Erick555 commented Dec 4, 2020

@jalberto could you show flatpak info -M md.obsidian.Obsidian.

--filesystem=~/.ssh shouldn't make any difference when app have --filesystem=home already. Did you override any permissions?

Also does printenv SSH_AUTH_SOCK show anything on your system?

@jalberto
Copy link
Author

jalberto commented Dec 7, 2020

[Context]
shared=network;ipc;
sockets=x11;pulseaudio;ssh-auth;
devices=dri;
filesystems=home;/media;/mnt;/run/media;
persistent=.ssh;

SSH_AUTH_SOCK -> /run/user/1000/keyring/ssh

@joshua-stone
Copy link
Collaborator

@jalberto Are you still experiencing this bug with the latest Obsidian builds?

@jalberto
Copy link
Author

Sorry for the huge delay, I thought I replied long ago.

Still hitting this, but now in Fedora 34, I need to add ~/.ssh explicitly to make it work as expected

@joshua-stone
Copy link
Collaborator

@jalberto Does it work with the latest flatpak build after resetting permissions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants