obsidian-git icon indicating copy to clipboard operation
obsidian-git copied to clipboard

Pushing not working

Open NicholasMamo opened this issue 3 years ago • 14 comments

I've installed this plugin, but I'm unable to push or pull commits. Whenever I push, the plugin creates a commit, but fails on pushing with this error (from the console). I have access rights to the repository, and I can push from the command line, so I'm not sure what the problem is. I'm on Ubuntu 20.04, and ssh-askpass is installed. I connect to my repository using SSH, not username/password.

The error and stack in question:

Uncaught (in promise) Error: Pushing to github.com:NicholasMamo/xyz.git
ssh_askpass: exec(/usr/libexec/ssh-askpass): No such file or directory
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

    at GitExecutorChain.onFatalException (eval at <anonymous> (app.js:1), <anonymous>:2536:85)
    at GitExecutorChain.eval (eval at <anonymous> (app.js:1), <anonymous>:2527:28)
    at Generator.throw (<anonymous>)
    at rejected (eval at <anonymous> (app.js:1), <anonymous>:2482:65)

NicholasMamo avatar Nov 23 '20 18:11 NicholasMamo

Hmm, could you try starting Obsidian from command line (using Obsidian AppImage) and see if the problem persists? If you're using flatpak:

/home/$USER/.local/share/flatpak/app/md.obsidian.Obsidian/current/active/files/obsidian 

denolehov avatar Nov 23 '20 20:11 denolehov

Thanks for the quick reply. It worked when launching the app from the command-line, but it doesn't work when I launch it from dash. Any idea why that is?

NicholasMamo avatar Nov 23 '20 21:11 NicholasMamo

I am not entirely sure, but most likely it is related to the fact that Obsidian instance that you're launching from dash is sandboxed, and it doesn't "see" your $PATH. I didn't pinpoint the issue yet, but it seems like an emerging pattern given other, similar issues some people have.

denolehov avatar Nov 23 '20 21:11 denolehov

Got it. Let me know if I can help in any way! :)

NicholasMamo avatar Nov 23 '20 21:11 NicholasMamo

As a workaround, you could try adding AppImage to dash manually.

denolehov avatar Nov 23 '20 21:11 denolehov

same issue using flatpack.

The workaround is: flatpak run --socket=ssh-auth md.obsidian.Obsidian but this requires to confirm host authenticity each time

jalberto avatar Dec 01 '20 15:12 jalberto

An update from 2 days ago seems to have fixed this issue for me. I'm not sure what update it was because the Obsidian version hasn't changed (it's been at version 0.9.17 for a few days now). Maybe it was an update to this plugin.

NicholasMamo avatar Dec 04 '20 13:12 NicholasMamo

~~Automatic push doesn't seem to work for me either (I set it to 5 minutes intervals), I'm on macOS with Obsidian v0.10.1, any way I can debug this to fix it?~~

Seems to work after changing the timings a few times and restarting the app. Not sure if just a setting got messed up?

pew avatar Dec 19 '20 06:12 pew

@NicholasMamo Can I close this now?

Vinzent03 avatar Mar 13 '21 22:03 Vinzent03

@NicholasMamo Can I close this now?

Not yet, I'm afraid. It hasn't worked for at least a month now. When I push, I get the error: "git: push failed to github.com:username/vault.git bad owner or permissions on vault.git".

NicholasMamo avatar Mar 14 '21 14:03 NicholasMamo

When you push changes from the command prompt. Do you have to type in some password or similar?

Vinzent03 avatar Mar 14 '21 14:03 Vinzent03

No, I use SSH to push changes. Pushing from the command prompt works flawlessly.

NicholasMamo avatar Mar 14 '21 14:03 NicholasMamo

FYI, take a look at this. https://github.com/denolehov/obsidian-git/issues/39#issuecomment-798955390

ebouchut avatar Mar 14 '21 19:03 ebouchut

This is what worked for me: https://github.com/denolehov/obsidian-git/issues/39#issuecomment-812216390

JeremyKennedy avatar Aug 04 '22 19:08 JeremyKennedy

I'm now trying to summarize auth methods here

Vinzent03 avatar Feb 06 '23 21:02 Vinzent03

One possible solution is to create a simple script


# Change to your project directory
cd /path/to/vault

# Add all changes
git add .

# Commit changes with a message
git commit -m "Automated commit"

# Push changes to the remote repository (change to master if needed)
git push origin main

then set a cron job to execute it for every 10 min let's say */10 * * * * /path/to/script P.S. you should set your access token from your gh

luk14n avatar Jan 30 '24 18:01 luk14n