LINUX.ORG.RU

git слетают права

 ,


0

3

слетают права на измененных файлах при git pull, добавляю что-нибудь в файл read.me

ls -la
total 5.8M
drwxrwxr-x 5 root root 4.0K Apr 25 14:31 .
drwxr-xr-x 3 root root 4.0K Apr 25 13:42 ..
drwxrwxr-x 2 root root 4.0K Apr 25 13:42 css
drwxrwxr-x 8 root root 4.0K Apr 25 14:32 .git
-rw-rwxr-- 1 root root 5.8M Apr 25 14:23 index.php
drwxrwxr-x 2 root root 4.0K Apr 25 13:42 js
-rw-rwxr-- 1 root root    7 Apr 25 14:31 read.me
# git add .
# git commit -m "test commit"
[master 551b471] test commit
 1 file changed, 1 insertion(+)

# git push -u origin master
Counting objects: 5, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 256 bytes | 0 bytes/s, done.
Total 3 (delta 1), reused 0 (delta 0)
To git@server:website/repo.git
   bb88999..551b471  master -> master
Branch master set up to track remote branch master from origin.

делаю на сервер git pull

$ ls -la
total 5.9M
drwxrwxr-x+ 5 user user 4.0K Apr 25 14:22 .
drwxr-x--x  9 user user 4.0K Apr 16 17:23 ..
drwxrwxr-x+ 8 user user 4.0K Apr 25 14:31 .git
drwxrwxr-x+ 2 user user 4.0K Apr 25 11:14 css
-rw-rwxr-x+ 1 user user 5.8M Apr 25 14:21 index.php
drwxrwxr-x+ 2 user user 4.0K Apr 25 11:14 js
-rw-rwxr--+ 1 user user    0 Apr 23 16:48 read.me

$ git pull
remote: Enumerating objects: 5, done.
remote: Counting objects: 100% (5/5), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 1), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From server:website/repo
   bb88999..551b471  master     -> origin/master
Updating bb88999..551b471
Fast-forward
 read.me | 1 +
 1 file changed, 1 insertion(+)
$ ls -la
total 5.9M
drwxrwxr-x+ 5 user user 4.0K Apr 25 14:32 .
drwxr-x--x  9 user user 4.0K Apr 16 17:23 ..
drwxrwxr-x+ 8 user user 4.0K Apr 25 14:32 .git
drwxrwxr-x+ 2 user user 4.0K Apr 25 11:14 css
-rw-rwxr-x+ 1 user user 5.8M Apr 25 14:21 index.php
drwxrwxr-x+ 2 user user 4.0K Apr 25 11:14 js
-rw-rw----+ 1 user user    7 Apr 25 14:32 read.me

пользователь root

umask
0022

пользователь user

umask
0002

везде стоит - core.filemode=false

из-за чего еще могу слетать права при git pull?


Из-за того, что ты под рутом пуши делаешь. Так и до патча бармина не далеко.

Делай под пользаком.

А там, где делаешь пулл, нужно либо умаск правильный поставить, либо пользака добавить в группу www-data.

deep-purple ★★★★★ ()
Ответ на: комментарий от deep-purple

не зависит от какого пользователя я делаю git push вот от себя сделал

$ ls -la
total 11816
drwxr-xr-x   7 my  staff      224 Apr 25 15:28 .
drwxr-xr-x   3 my  staff       96 Apr 25 15:28 ..
drwxr-xr-x  13 my  staff      416 Apr 25 15:29 .git
drwxr-xr-x   3 my  staff       96 Apr 25 15:28 css
-rw-r--r--   1 my  staff  6044363 Apr 25 15:28 index.php
drwxr-xr-x   4 my  staff      128 Apr 25 15:28 js
-rw-r--r--   1 my  staff       12 Apr 25 15:28 read.me
$ git push -u origin master
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 4 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 270 bytes | 270.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0)
To server:website/repo.git
   551b471..acebbf4  master -> master
Branch 'master' set up to track remote branch 'master' from 'origin'.

делаю pull

$ ls -la
total 5.9M
drwxrwxr-x+ 5 user user 4.0K Apr 25 14:32 .
drwxr-x--x  9 user user 4.0K Apr 16 17:23 ..
drwxrwxr-x+ 8 user user 4.0K Apr 25 14:32 .git
drwxrwxr-x+ 2 user user 4.0K Apr 25 11:14 css
-rw-rwxr--+ 1 user user 5.8M Apr 25 14:21 index.php
drwxrwxr-x+ 2 user user 4.0K Apr 25 11:14 js
-rw-rwxr--+ 1 user user    7 Apr 25 14:32 read.me
$ git pull
remote: Enumerating objects: 5, done.
remote: Counting objects: 100% (5/5), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 1), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From server:website/repo
   551b471..acebbf4  master     -> origin/master
Updating 551b471..acebbf4
Fast-forward
 read.me | 1 +
 1 file changed, 1 insertion(+)
$ ls -la
total 5.9M
drwxrwxr-x+ 5 user user 4.0K Apr 25 15:30 .
drwxr-x--x  9 user user 4.0K Apr 16 17:23 ..
drwxrwxr-x+ 8 user user 4.0K Apr 25 15:30 .git
drwxrwxr-x+ 2 user user 4.0K Apr 25 11:14 css
-rw-rwxr--+ 1 user user 5.8M Apr 25 14:21 index.php
drwxrwxr-x+ 2 user user 4.0K Apr 25 11:14 js
-rw-rw----+ 1 user user   12 Apr 25 15:30 read.me

так я скинул umask - 0002 пользователя, вроде все верно

Garcia ()
Последнее исправление: Garcia (всего исправлений: 2)