User Tools

Site Tools


howto:git

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
howto:git [2021/12/26 12:07] va7fihowto:git [2021/12/26 12:24] – [Test Scenarios] va7fi
Line 2: Line 2:
 ===== Test Scenarios ===== ===== Test Scenarios =====
 Summary: Summary:
-  * When cloning from remote to local, ''www-data'' group ownership is not preserved. +  * When cloning from remote to local or pushing from local to remote, ''www-data'' group ownership and ''770'' permissions are not preserved. 
-  * When pushing local changes to remote, need to checkout a different branch on remote first, and permissions are not preserved. +  * When pushing local changes to remote, the remote master can't be checkout out.
  
 +References:
 +  * [[https://stackoverflow.com/questions/3207728/retaining-file-permissions-with-git |stackoverflow]] question about permissions.
 +  * Using [[https://githooks.com/ |git hooks]] to run pre- and post- scripts to fix permissions.
 +  
 ==== Initial Cloning ==== ==== Initial Cloning ====
   * Create two files in a ''remote'' folder to simulate the wiki install on the server.   * Create two files in a ''remote'' folder to simulate the wiki install on the server.
Line 193: Line 196:
 -rwxrwx--- 1 ptruchon www-data 26 Dec 26 10:20 file2.txt -rwxrwx--- 1 ptruchon www-data 26 Dec 26 10:20 file2.txt
 </code> </code>
 +
 +==== www-data:www-data files ====
 +Sometimes Dokuwiki saves new files with the ''www-data:www-data'' ownership.  When this happens, Git is not able to override the changes.
 +
 +  * Change ownership of ''file2.txt'' or remote:<code bash>
 +~/gittest/remote$ sudo chown www-data:www-data file2.txt 
 +ls -l
 +total 24
 +-rwxrwxr-x 1 ptruchon www-data 50 Dec 26 12:01 file1.txt
 +-rwxrwx--- 1 www-data www-data 26 Dec 26 10:20 file2.txt
 +</code>
 +
 +  * Edit ''file2.txt'' on local and commit the changes:<code bash>
 +~/gittest/local$ git add .
 +git commit -m 'edited file2.txt on local'
 +[master b7c9353] edited file2.txt on local
 + 1 file changed, 1 insertion(+)
 +
 +git status
 +On branch master
 +Your branch is ahead of 'origin/master' by 1 commit.
 +  (use "git push" to publish your local commits)
 +
 +nothing to commit, working tree clean
 +
 +git log
 +commit b7c93538a15efe16ac60956ce3f77526ce43ec1d (HEAD -> master)
 +Author: Patrick Truchon <patoo@rbox.me>
 +Date:   Sun Dec 26 12:22:38 2021 -0800
 +
 +    edited file2.txt on local
 +
 +commit b7d91058fed9fe64c96525a3d0bef56c682ade68 (origin/master, origin/HEAD)
 +Author: Patrick Truchon <patoo@rbox.me>
 +Date:   Sun Dec 26 10:45:41 2021 -0800
 +
 +    changed file1.txt from local
 +
 +commit 0e5ccdedd1c9188996aadad3a8e2be5a319ab789
 +Author: Patrick Truchon <patoo@rbox.me>
 +Date:   Sun Dec 26 10:21:24 2021 -0800
 +
 +    initial commit on remote
 +</code>
 +
 +
howto/git.txt · Last modified: 2021/12/26 12:26 by va7fi