使用Quarto发布Github Pages时CNAME文件被自动删除如何解决?
Quarto发布GitHub Pages时自动删除CNAME文件的解决办法
问题
使用自定义域名部署GitHub Pages站点,相关配置完成后,执行quarto publish gh-pages命令发布网站时,Quarto会自动删除gh-pages分支中的CNAME文件。
已尝试的无效方案
参考相关Issue和PR,在_quarto.yml中添加资源配置,两种写法均未生效:
写法1:
project: resources: - CNAME
写法2:
project: resources: - "CNAME"
终端执行命令输出
user@user:~/Dokumente/Git-Repos/reponame$ quarto publish gh-pages ? Update site at https://username.github.io/reponame/? (Y/n) › Yes Von github.com:username/reponame * branch gh-pages -> FETCH_HEAD 46bab98..0380bd0 gh-pages -> origin/gh-pages Rendering for publish: [ 1/19] blog.qmd [../19] ....qmd [19/19] index.qmd Bereite Arbeitsverzeichnis vor (setze Branch 'gh-pages' um; war bei 46bab98) Branch 'gh-pages' folgt nun Remote-Branch 'gh-pages' von 'origin'. HEAD ist jetzt bei 0380bd0 Create CNAME [gh-pages 1c02f36] Built site for gh-pages 2 files changed, 1 insertion(+), 2 deletions(-) delete mode 100644 CNAME origin git@github.com:username/reponame.git (fetch) origin git@github.com:username/reponame.git (push) To github.com:username/reponame.git 0380bd0..1c02f36 HEAD -> gh-pages NOTE: GitHub Pages sites use caching so you might need to click the refresh button within your web browser to see changes after deployment. [✓] Deploying gh-pages branch to website (this may take a few minutes) [✓] Published to https://username.github.io/reponame/
解决方案
在本地仓库中创建CNAME文件(而非通过GitHub在线设置创建),即可解决Quarto发布时自动删除CNAME文件的问题。
内容的提问来源于stack exchange,提问作者apfelpfluecker
相关产品推荐
相关产品推荐

