Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error: restarting script because .git/FETCH_HEAD changed

I restart node.js server with forever by watchin files. Every few minutes I get message: error: restarting script because .git/FETCH_HEAD changed which restarts my server.

How to avoid that? It shall restart upon file change not git head change.

Watching script:

HOME=/root forever \
    --pidFile $PIDFILE \
    -a \
    -l $LOGFILE \
    --minUptime $MIN_UPTIME \
    --spinSleepTime $SPIN_SLEEP_TIME \
    --watch \
    --watchDirectory=$APPLICATION_PATH \
    start $APPLICATION_PATH$APPLICATION_SCRIPT 2>&1 > /dev/null &
RETVAL=$?
log_end_msg $RETVAL
like image 514
Szymon Toda Avatar asked Apr 16 '15 08:04

Szymon Toda


2 Answers

Use the watchIgnore directive to ignore your .git folder, just add this option :

--watchIgnore "**/.git/**"
like image 179
Tristan Foureur Avatar answered Oct 16 '22 04:10

Tristan Foureur


see #20 comment in: https://github.com/foreverjs/forever/issues/235

this problem is not solved in forever, works for many, fail for others. many developers fixed but 'cause is a pull request without tests still not merging yet.

like image 4
Stefan Yohansson Avatar answered Oct 16 '22 03:10

Stefan Yohansson