logseq-plugin-git icon indicating copy to clipboard operation
logseq-plugin-git copied to clipboard

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

Open dodo-the-dev opened this issue 3 years ago • 13 comments
trafficstars

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.

dodo-the-dev avatar Sep 01 '22 16:09 dodo-the-dev

me to

umrwifi avatar Sep 16 '22 14:09 umrwifi

same

zhaobenx avatar Sep 27 '22 05:09 zhaobenx

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

zhaobenx avatar Sep 27 '22 05:09 zhaobenx

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

negue avatar Oct 13 '22 22:10 negue

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

samueljklee avatar Dec 23 '22 00:12 samueljklee

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?

iamianvs avatar Jan 25 '23 21:01 iamianvs

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

aaronlonwilliams avatar Apr 02 '23 13:04 aaronlonwilliams

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.

akinxwumi avatar Apr 07 '23 12:04 akinxwumi

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?

hvddrift avatar May 10 '23 02:05 hvddrift

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

  • The git at /Applications/Logseq.app/Contents/Resources/app/node_modules/dugite/git/libexec/git-core/git can't push:
$ /Applications/Logseq.app/Contents/Resources/app/node_modules/dugite/git/libexec/git-core/git push
git: 'remote-https' is not a git command. See 'git --help'.
  • With some searching, that seems to mean that the git was not compiled with libcurl support.
  • After replacing this with my system's git, still no luck. I'm able to push:
$ 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.

peterhajas avatar May 28 '23 00:05 peterhajas

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 [email protected]:[username]/[reponame].git

davidefornelli avatar Jul 11 '23 18:07 davidefornelli