type
Post
status
Published
date
Apr 11, 2024
slug
summary
Logseq使用Git或Github自动同步的简单实现。
tags
Git
Logseq
笔记
category
技术分享
icon
password
PC端
- 安装 [[Git]] for windows
- 启用 [[Logseq]]的多版本控制自动git commit,会在图谱里面git init一个本地仓库进行历史版本记录
- 按照Logseq-Git-Sync-101教程进行配置
- 把
post-commitandpre-commit放到.git/hooks目录下 - 修改
post-commit中git push origin main为git push origin master - post-commit
- pre-commit
- 参考这个教程 添加了
.gitignore logseq/bak/ logseq/.recycle .DS_Store
- 中间会要求输入用户名和邮箱,以及登录github
iOS端
- 安装
working copy(需要16.2以上)
- 新建外部连接库(会员功功能,但是可以试用10天,之后仍可以拉取),在我的手机logseq应用目录里面新建logseq目录(图谱目录)
- 添加 [[github]] 远程仓库,进行拉取
- logseq里面新建仓储,选择已有仓库指定为上面创新的图谱目录即可
Mac端
git clone [email protected]:username/reponame.git一个本地库- 这一步因为是私有仓库,默认的用户名密码登录方式不能使用,只能使用 ssh-over-the-https 方式绕过默认被封的22号端口
- 为什么Win可以使用https挂远程仓库而Mac不行?还是我操作有误? #问题#Git
- 安装 [[Logseq]]
- 新建一个图库使用刚才的
clone的目录
- Mac 目录下会自动产生
.DS_Store,需要用find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch进行删除,并在.gitignore中添加
异常处理
由于电脑最近开合盖频繁死机,导致 [[Logseq]] 本地 [[Git]] 仓库损坏,提示
fatal: bad config line 1 in file .git/config,在本地目录把.git/config删除,在命令行重新添加一下远程目录即可恢复git remote add origin https://github.com/yourname/logseq.git