You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

无法将R语言pkgdown生成的包网站推送到GitHub的技术求助

Troubleshooting & Solutions for Your pkgdown + Git Issues

Let’s break down your two problems separately—they’re not directly linked, so we can fix them one at a time:

1. Why the docs/ folder isn’t showing up in Git’s commit panel

The most common culprit here is your project’s .gitignore file excluding the docs/ directory. Many R package templates (including those set up with usethis) add docs/ to .gitignore by default to avoid committing auto-generated content. Here’s how to fix it:

  • Open the .gitignore file in your project’s root directory.
  • Look for a line that says docs/. Either delete this line, or comment it out by adding a # at the start (like # docs/).
  • Save the .gitignore file.
  • In your terminal (or RStudio’s Terminal tab), run these commands to stage and commit the docs/ folder:
    git add docs/
    git commit -m "Add pkgdown-generated documentation site"
    git push
    

After this, the docs/ folder should appear in your Git commit history and be pushed to GitHub successfully.

2. Fixing the failed installation of pkgdown’s development version

The error message makes it clear: your installed version of rlang (0.4.10) is too old—pkgdown’s dev version requires rlang >= 0.99.0.9000. Here’s how to resolve this:

  • First, update rlang to meet the version requirement. Since the required version is a development build, install it from GitHub:
    devtools::install_github("r-lib/rlang")
    
  • Once rlang is updated successfully, try installing the pkgdown development version again:
    devtools::install_github("hadley/pkgdown")
    

If you still see warnings, run warnings() to check for minor dependency issues, but the main blocker here was the outdated rlang package.

No, they’re completely independent. The failure to install pkgdown’s dev version does not affect whether Git can see or track your docs/ folder. The docs/ visibility problem is solely a .gitignore configuration issue.

内容的提问来源于stack exchange,提问作者JaFranke

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.30 16:57:44