CharlesChiuGit / Logseq-Git-Sync-101

This repo aims to help Logseq users to sync their data with Git and GitHub.
MIT License
996 stars 82 forks source link

I met a error on win10, "Your configuration specifies to merge with the ref 'refs/heads/master' from the remote, but no such ref was fetched." #13

Closed OrdinaryYZH closed 1 year ago

OrdinaryYZH commented 1 year ago

I have done the step from this https://github.com/CharlesChiuGit/Logseq-Git-Sync-101/wiki/For-Windows-users

but I don't konw what the tips said , I search on web , but can't fix it

image

CharlesChiuGit commented 1 year ago

Can you use terminal to git pull and git push? If you can't, that means you got something wrong with your git configs.

Also make sure your branch name is master, the default one should be the main. image

In your {logseq graph folder}/.git/config:

[core]
    repositoryformatversion = 0
    filemode = false
    bare = false
    logallrefupdates = true
    symlinks = false
    ignorecase = true
    safecrlf = false
[remote "origin"]
    url = git@github.com:{username}/{logseq repo name}.git
    fetch = +refs/heads/*:refs/remotes/origin/*
[branch "main"]
    remote = origin
    merge = refs/heads/main

Please note that in the [branch "main"] section, there's a merge = refs/heads/main, which is consistent with the first screenshot.

OrdinaryYZH commented 1 year ago

I can pull and push by git bash or other GUI, and I try to edit the post-commit, git push origin main -> git push origin master,but the same problem, did I edit wrong?

my .git/config :

[core]
    repositoryformatversion = 0
    filemode = false
    bare = false
    logallrefupdates = true
    symlinks = false
    ignorecase = true
    safecrlf = false
[remote "origin"]
    url = xxxxxxxxxxxxx
    fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
    remote = origin
    merge = refs/heads/master

and it's a private repo

CharlesChiuGit commented 1 year ago

So your default branch is master, not main right?

Maybe try to pull your github repo and re-link your logseq to that newly-pulled folder? PLEASE backup your files before your do anything risky!! I would also recommand do a clear cache in logseq, maybe it would help.

CharlesChiuGit commented 1 year ago

I assum u got things worked out, close it for now. Feel free to reopen it again.

snorlaxjones commented 1 year ago

@CharlesChiuGit i've had this issue constantly for like a year, have re-cloned multiple times and it persists.

the only way i've found to "fix" it is to not use the pre-commit, even though pull before commiting is desirable

CharlesChiuGit commented 1 year ago

@snorlaxjones hmmm, I can't reproduce it and it never happened to me on other git-related projects.

So if u do things from the terminal, everything will be fine?