Skip to content
yvancouver edited this page May 2, 2014 · 10 revisions

Started the 2Mai2014

From this create an auto push/pull script

#!/bin/bash
 
#### CHANGE THE FOLLOWING 2 LINES TO MATCH YOUR ENVIRONMENT ###
NV_NOTES_PATH=~/Library/Application Support/Notational Data
GIT_PATH=/usr/local/bin
#### DO NOT CHANGE ANYTHING BELOW THIS LINE ####
 
STAT_FILE="YOU HAVE NEW FILES TO SYNC.txt"
cd "$NV_NOTES_PATH"
$GIT_PATH/git pull
$GIT_PATH/git push
 
GIT_STATUS=`$GIT_PATH/git status`
 
if [[ "$GIT_STATUS" =~ "nothing to commit" ]]
then
  if [ -e "$STAT_FILE" ]
  then
    rm "$STAT_FILE"
  fi
else
  echo "$GIT_STATUS" > "$STAT_FILE"
fi

to

#!/bin/bash
 
#### CHANGE THE FOLLOWING 2 LINES TO MATCH YOUR ENVIRONMENT ###
NV_NOTES_PATH=~Home/workspace/Workflow.wiki/
GIT_PATH=/usr/bin/
#### DO NOT CHANGE ANYTHING BELOW THIS LINE ####
 
STAT_FILE="YOU HAVE NEW FILES TO SYNC.txt"
cd "$NV_NOTES_PATH"
$GIT_PATH/git pull
$GIT_PATH/git push
 
GIT_STATUS=`$GIT_PATH/git status`
 
if [[ "$GIT_STATUS" =~ "nothing to commit" ]]
then
  if [ -e "$STAT_FILE" ]
  then
    rm "$STAT_FILE"
  fi
else
  echo "$GIT_STATUS" > "$STAT_FILE"
fi

I needed to change the .gitignore file , comment out *.txt and Notes & Settings. Furthermore the default file in nVAllGit was txt instead of md. Change that too.

Also change the > with >

Now need to have cron like system. Create the .plist file with this change , had to adjust link to the script.

Check in console if the script is called every 5 minutes , seems to work di not get any error message and the

Do I need to put the .txt in gitignore. I did because it will be sync with the repo (YOU HAVE NEW FILES TO SYNC.txt)

Seems to work just need to find out which files I have to exclude.

combination appears in NvAlt appears in Git sync with other machines comments
#Notes & Settings #*.txt Yes Yes yes but do I really need to sync the .txt file?
Notes & Settings #*.txt No and Yes No and Yes ? .txt need to be ignored otherwise it will modified and kept alive by git….

Seems to work now, cool.

Clone this wiki locally