I'm not sure why, but I keep getting this error when pushing some changes in Unison.
Synchronization complete at 11:49:01 (0 item transferred, 2 skipped, 0 failed)
skipped: /timetool/ana_combined (contents changed on both sides)
skipped: /timetool/plot_delays.py (contents changed on both sides)
I've seen some solutions that use the -prefer newer
tag, but I'm not sure if this will work in my case. The server I'm working with is in Japan, while I'm working in the USA. As such, the timestamps are different for each file.
This is the current Unison command I'm using (with some minor changes to keep anonymity):
unison -auto -ignore='Name {.idea,miniconda,reborn.egg-info,*.swp,*.log,*.so,build,*.pyc,*cache*,conda_env,anaconda3,results,home}' $1 \
-servercmd /home/local/bin/unison /home/my/path/ohyeah \
ssh://server//home/my/server/path/ohyeah
Everything works fine except for this occasional error. I don't make any changes on the server side, but I still seem to get this error and I'm not sure how to force the changes I want.
I'll answer my own question, I think I found a solution.
I added the -prefer root
flag to my sync script to get this working. It does what the name implies, it compares the versions and propagates the changes based on your preference.
i.e., the code:
unison -auto -ignore='Name {.idea,miniconda,reborn.egg-info,*.swp,*.log,*.so,build,*.pyc,*cache*,conda_env,anaconda3,results,home}' $1 \
-servercmd /home/local/bin/unison /home/my/path/ohyeah \
ssh://server//home/my/server/path/ohyeah -prefer /home/my/path/ohyeah
sets the preference to be my local machine. This might be problematic if, for example, someone edits the code in the server directory. When I sync the files, it'll overwrite the changes the person did with whatever is local to my machine.