jachin / GitSync

This tool allows a developer to work on files on their local machine and have their work synced on a remote system. It uses git to manage the syncing process.
MIT License
31 stars 3 forks source link

Initial sync aborts if permissions aren't set up properly on the remote server #14

Open natevolker opened 10 years ago

natevolker commented 10 years ago

If the remote file "file.png" doesn't have the correct permissions, the following error happens on the initial sync:

[user@example.com] Executing task 'initial_sync'
[user@example.com] Setting up /remote/dir/
[user@example.com] The git repo already exist: /remote/dir/.git
[localhost] local: git clone ssh://example.com/remote/dir/ /local/dir/
Cloning into '/local/dir'...
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (3/3), done.
[localhost] local: git branch branch
[localhost] local: git checkout branch
Switched to branch 'branch'
[user@example.com]  /remote/dir/ (remote) has uncommitted changes.
[user@example.com] run: git add .
[user@example.com] out: error: open("file.png"): Permission denied
[user@example.com] out: error: unable to index file file.png
[user@example.com] out: fatal: adding files failed
[user@example.com] out: 

Fatal error: run() received nonzero return code 128 while executing!

Requested: git add .
Executed: /bin/bash -l -c "cd /remote/dir/ && git add ."

Aborting.

To get the initial sync to work again (after fixing the permissions issue), you need to delete both the local directory, and the ".git" directory from the remote server.

centerorbit commented 10 years ago

Ahhh I did notice this too, I encountered it for sites that had a data directory in which the files were under a different permission. My "solution" was to git ignore data directory to ignore the file upload directory, since I wasn't running anything locally. But I agree, this should be properly handled.

Also, welcome!