haydenull / logseq-plugin-git

A git plugin for logseq
MIT License
110 stars 20 forks source link

Git push failed fatal: could not read Username for 'https://github.com': No such device or address #17

Open dodo-the-dev opened 1 year ago

dodo-the-dev commented 1 year ago

I seem to be able to pull from the repo my logseq file is in no problems, but it won't let me push to it coming up with the following error:

Git push failed fatal: could not read Username for 'https://github.com': No such device or address

I've looked everywhere I can, but I can't find where to update the credentials (if there is such a place). I apologise if I'm being dumb.

umrwifi commented 1 year ago

me to

zhaobenx commented 1 year ago

same

zhaobenx commented 1 year ago

hi guys, I found a way to solve this issue. You need to generate a github token and change your upstream settings. Follow the link on how to do this: https://stackoverflow.com/a/68779977/8550989

negue commented 1 year ago

I didn't wanted the token in the remote url and after many fails I got it to work with this:

  1. open the terminal
  2. go to /Applications/Logseq.app/Contents/Resources/app/node_modules/dugite/git/libexec/git-core
  3. execute sudo ln -s /usr/local/git/bin/git-credential-osxkeychain ./git-credential-osxkeychain

This links the "normal" osxkeychain binary to the dugite/git/libexec folder which seems to have most of the git binaries linked? and with that it works

I don't have any idea if this could be added to the dugite node package itself - or if logseq has to add it or even if its possible to do in this plugin - don't have enough logseq experience yet xD

samueljklee commented 1 year ago

If you were using HTTPS for your git config url, change it to SSH link. that resolves this issue for me. I'm on MacOS.

CleanShot 2022-12-22 at 16 20 36@2x
Bibabidu commented 1 year ago

I'm on Linux using git-credential-libsecret and due to the way my Gitea is setup, I cannot use SSH but rather rely on HTTPS. Is there a way I can fix the issue anyway?

aaronlonwilliams commented 1 year ago

The information above was helpful but had to do some trial and error to finally get it right. Here are the steps that got it working.

akinxwumi commented 1 year ago

The information above was helpful but had to do some trial and error to finally get it right. Here are the steps that got it working.

  • Change the remote URL to use SSH token. How to change git remote URL:

    • Go here to generate a token: https://github.com/settings/tokens
    • Add repo scopes and generate the token, save the token in a secure place.
    • Open terminal in the Logseq graph folder
    • View current remotes: git remote -v
    • Change remote URL: git remote set-url origin https://[token]@github.com/[username]/[repo_name].git

Thanks a lot 🙏🏾. This saved me a whole lot of headache.

hvddrift commented 1 year ago

I'm on Linux using git-credential-libsecret and due to the way my Gitea is setup, I cannot use SSH but rather rely on HTTPS. Is there a way I can fix the issue anyway?

I am in the same situation as you. Did you find a solution?

peterhajas commented 1 year ago

Some research I did into this issue based off of @negue's suggestion (I am a self-hosted gitea user with an https URL):

$ which git
/opt/homebrew/bin/git
$ rm /Applications/Logseq.app/Contents/Resources/app/node_modules/dugite/git/libexec/git-core/git
$ sudo ln -s /opt/homebrew/bin/git /Applications/Logseq.app/Contents/Resources/app/node_modules/dugite/git/libexec/git-core/git
$ /Applications/Logseq.app/Contents/Resources/app/node_modules/dugite/git/libexec/git-core/git push
Enumerating objects...

but the plugin can't. Bummer! I'm not sure if there is a way to proceed here without manually pushing. Committing with the plugin works great.

davidefornelli commented 12 months ago

Thank you for the guide! I slightly changed it to use it with an SSH URL:

...

  • Open terminal in the Logseq graph folder
  • View current remotes: git remote -v
  • Change remote URL: git remote set-url origin git@github.com:[username]/[reponame].git