HenryQW / Awesome-TTRSS

🐋 Awesome TTRSS, a powerful Dockerised all-in-one RSS solution.
http://ttrss.henry.wang
MIT License
2.4k stars 499 forks source link

[BUG] fatal: detected dubious ownership in repository at '/var/www' #457

Closed huangwb8 closed 5 months ago

huangwb8 commented 1 year ago

Bug 描述 将/var/www挂载到物理目录后出现权限问题,导致ttrss每分钟产生一个类似的error:

Unable to determine version: Git error [RC=128]: fatal: detected dubious ownership in repository at '/var/www'
To add an exception for this directory, call:

    git config --global --add safe.directory /var/www

Real IP: xxx
Forwarded For: xxx, xxx
Forwarded Protocol: https
Remote IP: 192.168.80.1
Request URI: /backend.php
User agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36 Edg/113.0.1774.35

这个bug无法在进入ttrss后运行git config --global --add safe.directory /var/www解决。

部署方法

首次安装后,我将/var/www/挂载到根目录,然后重新挂载整个目录。这样方便通过备份根目录来备份整个ttrss。

version: "3"
services:
  service.rss:
    image: wangqiru/ttrss:latest
    container_name: ttrss
    ports:
      - 3894:80 # 按需修改
    environment:
      - SELF_URL_PATH=https://rss.domain.com/ # 按需修改
      - DB_PASS=ipbufQW8F2 # 按需修改。与下面的密码对应
    volumes:
      # - ./feed-icons:/var/www/feed-icons/
      - ./www/:/var/www/
    networks:
      - public_access
      - service_only
      - database_only
    stdin_open: true
    tty: true
    restart: always

  service.mercury:
    image: wangqiru/mercury-parser-api:latest
    container_name: mercury
    networks:
      - public_access
      - service_only
    restart: always

  service.opencc:
    image: wangqiru/opencc-api-server:latest
    container_name: opencc
    environment:
      - NODE_ENV=production
    networks:
      - service_only
    restart: always

  database.postgres:
    image: postgres:13-alpine
    container_name: postgres
    environment:
      - POSTGRES_PASSWORD=ipbufQW8F2 # 按需修改。与上面的密码对应
    volumes:
      - ./db/:/var/lib/postgresql/data
    networks:
      - database_only
    restart: always

networks:
  public_access: 
  service_only: 
    internal: true
  database_only: 
    internal: true

预期结果

该bug可以消失。

截屏

image

错误日志 当错误发生时,通过终端执行 docker logs ttrss --tail 100 获取日志,并将相关错误日志粘贴于此处。

fatal: detected dubious ownership in repository at '/var/www'
To add an exception for this directory, call:

        git config --global --add safe.directory /var/www in /var/www/classes/config.php on line 321

[09:19:11/717] Using task id 1
[09:19:11/717] Lock: update_daemon-715.lock
[09:19:11/716] Using task id 0
[09:19:11/716] Lock: update_daemon-714.lock
[09:19:11/717] Waiting before update (5)...
[09:19:11/716] Waiting before update (0)...
[09:19:11/716] Scheduled 21 feeds to update...
[09:19:11/716] Base feed: https://rhrn2.hwb0307.com/bilibili/user/video/308693140?key=xBxyEqTtGm
[09:19:11/716] => Bilibili-声物课 (ID: 127, U: admin [1]), last updated: 2023-05-08 05:18:06
PHP Warning:  Undefined array key 1 in /var/www/classes/config.php on line 362
PHP Warning:  Undefined array key 2 in /var/www/classes/config.php on line 362
PHP Warning:  Unable to determine version: Git error [RC=128]: warning: unable to access '/root/.config/git/config': Permission denied
warning: unable to access '/root/.gitconfig': Permission denied
fatal: detected dubious ownership in repository at '/var/www'
To add an exception for this directory, call:

        git config --global --add safe.directory /var/www in /var/www/classes/config.php on line 321
[09:19:11/720] Lock: update_daemon-feed-127.lock
[09:19:15/716] <= 3.6035 (sec) exit code: 0
[09:19:15/716] Base feed: https://blog.devtang.com/atom.xml
[09:19:15/716] => 唐巧的博客 (ID: 116, U: admin [1]), last updated: 2023-05-08 09:03:05
PHP Warning:  Undefined array key 1 in /var/www/classes/config.php on line 362
PHP Warning:  Undefined array key 2 in /var/www/classes/config.php on line 362
PHP Warning:  Unable to determine version: Git error [RC=128]: warning: unable to access '/root/.config/git/config': Permission denied
warning: unable to access '/root/.gitconfig': Permission denied
fatal: detected dubious ownership in repository at '/var/www'
To add an exception for this directory, call:

        git config --global --add safe.directory /var/www in /var/www/classes/config.php on line 321
[09:19:15/725] Lock: update_daemon-feed-116.lock
[09:19:15/716] <= 0.4853 (sec) exit code: 0
[09:19:15/716] Base feed: https://github.com/Chanzhaoyu/chatgpt-web/releases.atom
[09:19:15/716] => chatgpt-web (ID: 274, U: admin [1]), last updated: 2023-05-08 09:03:08
PHP Warning:  Undefined array key 1 in /var/www/classes/config.php on line 362
PHP Warning:  Undefined array key 2 in /var/www/classes/config.php on line 362
PHP Warning:  Unable to determine version: Git error [RC=128]: warning: unable to access '/root/.config/git/config': Permission denied
warning: unable to access '/root/.gitconfig': Permission denied
fatal: detected dubious ownership in repository at '/var/www'
To add an exception for this directory, call:

        git config --global --add safe.directory /var/www in /var/www/classes/config.php on line 321
[09:19:15/728] Lock: update_daemon-feed-274.lock
[09:19:16/717] Scheduled 0 feeds to update...
[09:19:16/717] Sending digests, batch of max 15 users, headline limit = 1000
[09:19:16/717] All done.
[09:19:17/33] Child process with PID 715 reaped.
[09:19:17/33] Received SIGCHLD, 1 active tasks left.
[09:19:17/716] <= 2.3278 (sec) exit code: 0
[09:19:17/716] Base feed: https://rsshub.app/hellogithub/article
[09:19:17/716] => HelloGitHub - Article (ID: 168, U: admin [1]), last updated: 2023-05-08 09:03:08
PHP Warning:  Undefined array key 1 in /var/www/classes/config.php on line 362
PHP Warning:  Undefined array key 2 in /var/www/classes/config.php on line 362
PHP Warning:  Unable to determine version: Git error [RC=128]: warning: unable to access '/root/.config/git/config': Permission denied
warning: unable to access '/root/.gitconfig': Permission denied
fatal: detected dubious ownership in repository at '/var/www'
To add an exception for this directory, call:

        git config --global --add safe.directory /var/www in /var/www/classes/config.php on line 321
[09:19:18/733] Lock: update_daemon-feed-168.lock
[09:19:18/716] <= 0.2422 (sec) exit code: 0
[09:19:18/716] Base feed: https://www.youtube.com/feeds/videos.xml?channel_id=UCA0gaB71yl2p_g5WlO5zljw
[09:19:18/716] => 洋葱 (ID: 264, U: admin [1]), last updated: 2023-05-08 09:03:09
PHP Warning:  Undefined array key 1 in /var/www/classes/config.php on line 362
PHP Warning:  Undefined array key 2 in /var/www/classes/config.php on line 362
PHP Warning:  Unable to determine version: Git error [RC=128]: warning: unable to access '/root/.config/git/config': Permission denied
warning: unable to access '/root/.gitconfig': Permission denied
fatal: detected dubious ownership in repository at '/var/www'
To add an exception for this directory, call:

        git config --global --add safe.directory /var/www in /var/www/classes/config.php on line 321
[09:19:18/736] Lock: update_daemon-feed-264.lock
[09:19:19/716] <= 1.4165 (sec) exit code: 0
[09:19:19/716] Base feed: https://daimajia.com/feed
[09:19:19/716] => 代码家 (ID: 8, U: admin [1]), last updated: 2023-05-08 09:03:09
PHP Warning:  Undefined array key 1 in /var/www/classes/config.php on line 362
PHP Warning:  Undefined array key 2 in /var/www/classes/config.php on line 362
PHP Warning:  Unable to determine version: Git error [RC=128]: warning: unable to access '/root/.config/git/config': Permission denied
warning: unable to access '/root/.gitconfig': Permission denied
fatal: detected dubious ownership in repository at '/var/www'
To add an exception for this directory, call:

        git config --global --add safe.directory /var/www in /var/www/classes/config.php on line 321
[09:19:19/741] Lock: update_daemon-feed-8.lock
[09:19:20/716] <= 0.6642 (sec) exit code: 0
[09:19:20/716] Base feed: https://blogs.rstudio.com/tensorflow/index.xml
[09:19:20/716] => RStudio AI Blog (ID: 191, U: admin [1]), last updated: 2023-05-08 09:03:12
PHP Warning:  Undefined array key 1 in /var/www/classes/config.php on line 362
PHP Warning:  Undefined array key 2 in /var/www/classes/config.php on line 362
PHP Warning:  Unable to determine version: Git error [RC=128]: warning: unable to access '/root/.config/git/config': Permission denied
warning: unable to access '/root/.gitconfig': Permission denied
fatal: detected dubious ownership in repository at '/var/www'
To add an exception for this directory, call:

        git config --global --add safe.directory /var/www in /var/www/classes/config.php on line 321
[09:19:20/744] Lock: update_daemon-feed-191.lock

其他

暂无。

mapleshadow commented 11 months ago

找到解决方案了:https://tt-rss.org/wiki/InstallationNotes 这是官方的容器配置,里面有UID GID参数等,而且还有PHP的性能配置,配置到容器内就搞定了!!!

TonyRL commented 5 months ago

Duplicate of #387