致命:不安全的存储库归别人所有-Github Actions Workflow

发布于 2025-02-02 18:41:47 字数 902 浏览 3 评论 0原文

我在GitHub操作中配置了两个YML文件。当将新代码推向主机时,一个YML文件将文件部署到特定的网站文件夹,另一个文件将文件部署到另一个网站文件夹。 即使两个网站都在同一台服务器上,但其中一个Deploy.yml文件没有执行作业,而是引发了此错误。

fatal: unsafe repository ('/var/www/yayyy.net/public_html' is owned by someone else)
To add an exception for this directory, call:
    
        git config --global --add safe.directory /var/www/yyyy.net/public_html
    Error: Process completed with exit code 128.

在此步骤中:

- name: Add temp repo access
  run: |
    cd $DEV_WEBSITE_PATH
    git remote set-url origin https://anything:${{ secrets.GITHUB_TOKEN }}@github.com/yyyyy/website.git

我尝试在此步骤之前添加额外的步骤并添加此SAFE.DIRECTORY命令,但随后显示了拒绝错误。

error: could not lock config file /var/www/.gitconfig: Permission denied

添加sudo然后在命令引发此错误之前:

sudo: sorry, you must have a tty to run sudo

我很困惑我缺少什么,您能帮忙吗?

I have two yml files configured in the GitHub actions. When new code is pushed to master, one yml file deploys the files to specific website folder, and the other one to another website folder.
Even though both websites are on the same server, one of the deploy.yml files is not executing jobs and it's throwing this error.

fatal: unsafe repository ('/var/www/yayyy.net/public_html' is owned by someone else)
To add an exception for this directory, call:
    
        git config --global --add safe.directory /var/www/yyyy.net/public_html
    Error: Process completed with exit code 128.

at this step:

- name: Add temp repo access
  run: |
    cd $DEV_WEBSITE_PATH
    git remote set-url origin https://anything:${{ secrets.GITHUB_TOKEN }}@github.com/yyyyy/website.git

I tried adding extra step before that step and added this safe.directory command but then it's showing permission denied error.

error: could not lock config file /var/www/.gitconfig: Permission denied

Adding sudo before the command then throws this error:

sudo: sorry, you must have a tty to run sudo

I'm confused what I'm missing, can you help?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

蓝海似她心 2025-02-09 18:41:47

.gitConfig不存在,用户名毫无权限来创建它。因此,我手动创建了它,并将所有权更改为用户名

The.gitconfig did not exist and the username didn't have permission to create it. So, I created it manually and changed ownership to the username.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文