Gitlab页面在访问时抛出404 [英] Gitlab Pages throw 404 when accessed

查看:3586
本文介绍了Gitlab页面在访问时抛出404的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个具有以下名称的小组项目(托管在Gitlab中):gitlab.com/my-group/my-project.

I have a group project with the following name (hosted in Gitlab): gitlab.com/my-group/my-project.

我已经在测试过程中生成了覆盖率报告,并使用Gi​​tlab CI将其保存为工件.这是Gitlab CI配置:

I have generated coverage reports during testing and saved them as artifacts using Gitlab CI. Here is Gitlab CI config:

test:
  stage: test
  image: node:11
  before_script:
    - npm install -g yarn
    - yarn
  cache:
    paths:
      - node_modules/
  script:
    - yarn lint
    - yarn test --all --coverage src/
  except:
    - tags
  artifacts:
    paths:
      - coverage/
  coverage: '/Statements\s+\:\s+(\d+\.\d+)%/'

deploy-pages:
  stage: deploy
  dependencies:
    - test
  script:
    - mv coverage/ public/
  artifacts:
    paths:
      - public/
    expire_in: 30 days
  except:
    - tags

当我打开部署阶段作业时,可以看到正在创建的工件.这是屏幕截图:.所有文件都在工件的/public目录下.

When I open deploy stage job, I can see the artifact being created. Here is the screenshot: . All the files are under /public directory in the artifact.

现在,当我转到以下位置时: https://my-group.gitlab.io/我的项目,我不断收到404.

Now, when I go to: https://my-group.gitlab.io/my-project, I keep getting 404.

我不确定我在这里缺少什么步骤.有人可以帮我阐明一下这个问题吗?

I am not sure what step I am missing here. Can someone shed some light on this issue for me?

谢谢!

推荐答案

共有三个

  • 项目必须命名为group.gitlab.io(如果您希望它是基础域)
  • 职位必须在公共目录中创建工件
  • 职位必须称为pages
    • project must be named group.gitlab.io (if you want it to be the base domain)
    • job must create artifact in public directory
    • job must be called pages

    由于您的工作当前称为deploy-pages,因此很可能是最后一个需要修复的问题.只需将其重命名为pages.

    Most likely it's the last one that needs fixing since your job is currently called deploy-pages. Simply rename that to pages.

    您会知道何时一切正常,因为在设置">页面"下,它将告诉您链接发布到的链接.

    You'll know when you got everything working because under Settings > Pages, it will tell you the link where it's published to.

    这篇关于Gitlab页面在访问时抛出404的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆