Comments (12)
Did you use the exact git-hooks files I provided?
line 11 shouldn't execute anything at all.
from logseq-git-sync-101.
I was using the exact sheet, but took those two commented lines out that were at line 11 to see if it was causing the issue. Now I have the below script and get the below message, which lines up with the if statement that seems to be causing the issue.
#!/bin/sh
#
# Pull before committing
# Credential handling options:
# - hardcode credentials in URL
# - use ssh with key auth
# - https://git-scm.com/docs/git-credential-store
# - git credential helper on windows
output=$(git pull --no-rebase)
# Handle non error output as otherwise it gets shown with any exit code by logseq
if [[ "$output" == "Already up to date." ]]; then
# no ouput
exit 0
else
# probably error print it to screen
echo $output
fi
git add -A
10:36:03.482 › [Git] .git/hooks/pre-commit: 13: [[: not found
Already up to date.
from logseq-git-sync-101.
Maybe the space character or the newline character are having issues on windows and linux.
I don't think it's a big problem. But if you very want to get rid of it, maybe you can re-type the pre-commits
. Remember to use the .sample
files in the .git/hooks
as template because the file type is very unique.
from logseq-git-sync-101.
Once I made the slight modifications below it began working. May be useful to note for any additional Linux users. I didn't dive too much farther into it, but I am assuming the sh interpreter does not include the double brackets as valid if syntax or something along those lines.
Thanks again for putting this all together, very excited to get this all integrated!
#!/bin/sh
output=$(git pull --no-rebase)
# Handle non error output as otherwise it gets shown with any exit code by logseq
if [ "$output" = "Already up to date." ]
then
# no ouput
exit 0
else
# probably error print it to screen
echo "else"
# echo $output
fi
git add -A
from logseq-git-sync-101.
Interesting!
If it's the interpreter that goes wrong, maybe you can try replace #!/bin/bash
with #!/bin/sh
from logseq-git-sync-101.
It's not the interpreter. It's a bug in your pre-commit script, which has [[ ]] instead of [ ].
I'll do a pr later.
from logseq-git-sync-101.
@romilly thanks! So my pre-commit script will act differently on different platform? Is there a more robust way to do it?
from logseq-git-sync-101.
I'm no expert, and I have no access to Windows or OS/X - Linux only I'm afraid.
Also I am now getting a (slightly different) error. I'll do a PR when it's working :)
from logseq-git-sync-101.
Cool!
from logseq-git-sync-101.
Doh! The code is fine, it's the difference between sh and bash on recent Linuxes.
With #!/bin/bash
as the shebang, all works.
from logseq-git-sync-101.
And thanks for an excellent guide!
from logseq-git-sync-101.
Cool! So just the shebang? [[ ]]
is actuacally fine? If that's the only problem I'll fix it right now.
from logseq-git-sync-101.
Related Issues (20)
- Adding encryption with git-remote-gcrypt HOT 5
- Add `a-shell` as a free alternative for ios/ipados devices. HOT 1
- Add `.gitattributes` file with `* merge=union` to avoild merge confilts
- Question re Version Control HOT 36
- Add the official Logseq sync option HOT 2
- set up Git sync for existing graphs HOT 3
- Windows Instructions do not work GitHub does not trust PC without SSH ????? HOT 29
- Instructions for Linux Users HOT 1
- Add some safe checks from `git-auto`
- github unreachable on android. HOT 11
- fatal: cannot lock ref 'HEAD' HOT 9
- Wrong path of source file on Android 11, and extra line needed for not asking for pass phrase. HOT 1
- How can apply the step 8 of guide for mac in case of linux? HOT 15
- ssh-add not found in a-Shell HOT 9
- Bug: Invalid path when loading graph from `Termux` HOT 7
- Git push failed on Windows: Permission denied HOT 3
- Step 4 in For iOS iPadOS users (Working Copy) --> out of date HOT 5
- Add community plugin logsync
- Be objective to Syncthing :) Working solution exists on iOS HOT 2
- Followed the guide for macOS, but I'm getting this error (screen attached) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from logseq-git-sync-101.