048.md 19.2 KB
Newer Older
Lab机器人's avatar
readme  
Lab机器人 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303
# Projects

> 原文:[https://docs.gitlab.com/ee/user/project/](https://docs.gitlab.com/ee/user/project/)

*   [Project features](#project-features)
    *   [Project integrations](#project-integrations)
*   [New project](#new-project)
    *   [Fork a project](#fork-a-project)
    *   [Star a project](#star-a-project)
    *   [Explore projects](#explore-projects)
*   [Project settings](#project-settings)
*   [Import or export a project](#import-or-export-a-project)
*   [Remove a project](#remove-a-project)
    *   [Delayed removal](#delayed-removal-premium)
*   [CI/CD for external repositories](#cicd-for-external-repositories-premium)
*   [Project members](#project-members)
*   [Project activity](#project-activity)
    *   [Leave a project](#leave-a-project)
*   [Project’s landing page](#projects-landing-page)
*   [Redirects when changing repository paths](#redirects-when-changing-repository-paths)
*   [Use your project as a Go package](#use-your-project-as-a-go-package)
    *   [Disable Go module features for private projects](#disable-go-module-features-for-private-projects)
    *   [Authenticate Go requests](#authenticate-go-requests)
    *   [Authenticate Git fetches](#authenticate-git-fetches)
*   [Access project page with project ID](#access-project-page-with-project-id)
*   [Project aliases](#project-aliases-premium-only)
*   [Project APIs](#project-apis)

# Projects[](#projects "Permalink")

在 GitLab 中,您可以创建用于托管代码库的项目,将其用作问题跟踪器,在代码上进行协作,并使用内置的 GitLab CI / CD 持续构建,测试和部署应用程序.

您可以[选择](../../public_access/public_access.html)公开,内部或私有[使用](../../public_access/public_access.html)您的项目. GitLab 不限制您创建的私人项目的数量.

## Project features[](#project-features "Permalink")

在 GitLab 中创建项目时,您将可以使用大量[功能](https://about.gitlab.com/features/)

**Repositories:**

*   [问题跟踪器](issues/index.html) :与您的团队讨论问题内的实现
    *   [发行板](issue_board.html) :组织工作流程并确定其优先级
    *   [多个发行板](issue_board.html#multiple-issue-boards) :允许您的团队为同一项目创建自己的工作流(发行板)
*   [存储库](repository/index.html) :将代码托管在完全集成的平台中
    *   [分支](repository/branches/index.html) :使用 Git 分支策略在代码上进行协作
    *   [受保护的分支机构](protected_branches.html) :防止协作者弄乱历史记录或在未经审查的情况下推送代码
    *   [受保护的标签](protected_tags.html) :控制谁有权创建标签,并防止意外更新或删除
    *   [储存库镜​​像](repository/repository_mirroring.html)
    *   [签署提交](gpg_signed_commits/index.html) :使用 GPG 签署您的提交
    *   [部署令牌](deploy_tokens/index.html) :管理基于项目的部署令牌,这些令牌允许永久访问存储库和 Container Registry.
*   [Web IDE](web_ide/index.html)

**发出和合并请求:**

*   [问题跟踪器](issues/index.html) :与您的团队讨论问题内的实现
    *   [发行板](issue_board.html) :组织工作流程并确定其优先级
    *   [多个发行板](issue_board.html#multiple-issue-boards) :允许您的团队为同一项目创建自己的工作流(发行板)
*   [合并请求](merge_requests/index.html) :应用您的分支策略并获得团队的审查
    *   [合并请求批准](merge_requests/merge_request_approvals.html) :实施更改之前[请求批准](merge_requests/merge_request_approvals.html)
    *   [修复 UI 中的合并冲突](merge_requests/resolve_conflicts.html) :直接从 GitLab UI 中使用 Git diff 工具
    *   [审查应用程序](../../ci/review_apps/index.html) :按分支实时预览合并请求中建议的更改结果
*   [标签](labels.html) :按标签整理问题并合并请求
*   [时间跟踪](time_tracking.html) :跟踪估计在完成问题或合并请求上花费的时间和时间
*   [里程碑](milestones/index.html) :朝着目标日期迈进
*   [描述模板](description_templates.html) :为项目定义特定于上下文的模板,并为您的项目合并请求描述字段
*   [斜杠命令(快速操作)](quick_actions.html) :针对问题或合并请求的常见操作的文本快捷方式
*   [自动完成字符](autocomplete_characters.html) :自动完成对用户,组,问题,合并请求和其他 GitLab 元素的引用.
*   [Web IDE](web_ide/index.html)

**亚搏体育 app CI / CD:**

*   [GitLab CI / CD](../../ci/README.html) :GitLab 内置的[持续集成,交付和部署](https://about.gitlab.com/blog/2016/08/05/continuous-integration-delivery-and-deployment-with-gitlab/)工具
    *   [容器注册表](../packages/container_registry/index.html) :开箱即用地构建和推送 Docker 映像
    *   [自动部署](../../topics/autodevops/stages.html#auto-deploy) :配置 GitLab CI / CD 以自动设置应用程序的部署
    *   [启用和禁用 GitLab CI / CD](../../ci/enable_or_disable_ci.html)
    *   [管道](../../ci/pipelines/index.html) :从 UI 配置和可视化 GitLab CI / CD 管道
        *   [计划的管道](../../ci/pipelines/schedules.html) :计划管道以在选定的时间开始
        *   [管道图](../../ci/pipelines/index.html#visualize-pipelines) :通过 UI 查看整个管道
        *   [作业工件](../../ci/pipelines/job_artifacts.html) :定义,浏览和下载作业工件
        *   [管道设置](../../ci/pipelines/settings.html) :设置 Git 策略(选择从作业中的 GitLab 提取存储库的默认方式),超时(定义可以运行作业的最长时间(以分钟为`.gitlab-ci.yml` )) `.gitlab-ci.yml`自定义路径,测试覆盖率分析,管道的可见性等
    *   [Kubernetes 集群集成](clusters/index.html) :将您的 GitLab 项目与 Kubernetes 集群连接
    *   [功能标志](../../operations/feature_flags.html) :功能标志允许您通过动态切换某些功能来以不同的方式发布项目
*   [GitLab Pages](pages/index.html) :使用[GitLab Pages](pages/index.html)构建,测试和部署您的静态网站

**其他特性:**

*   [Wiki](wiki/index.html) :在集成的 Wiki 中记录您的 GitLab 项目.
*   [片段](../snippets.html) :存储,共享和协作代码片段.
*   [价值流分析](cycle_analytics.html) :查看您的开发生命周期.
*   [见解](insights/index.html) :配置对您的项目至关重要的见解.
*   [安全仪表板](security_dashboard.html) :安全仪表板.
*   [语法突出显示](highlighting.html) :一种自定义代码块的替代方法,它替代了 GitLab 的默认语言选择.
*   [徽章](badges.html) :项目概述的徽章.
*   [发行版](releases/index.html) :一种跟踪项目中可交付成果的方式,可作为源,构建输出,其他元数据和与代码的发行版本相关的其他工件的快照.
*   [Conan 软件包](../packages/conan_repository/index.html) :您在 GitLab 中的私人 Conan 存储库.
*   [Maven 软件包](../packages/maven_repository/index.html) :您在 GitLab 中的私有 Maven 存储库.
*   [NPM 软件包](../packages/npm_registry/index.html) :您在 GitLab 中的私有 NPM 软件包注册表.
*   [代码所有者](code_owners.html) :为某些文件指定代码所有者
*   [许可证合规性](../compliance/license_compliance/index.html) :批准和拒绝项目的许可证.
*   [依赖项列表](../application_security/dependency_list/index.html) :查看项目依赖项.
*   [要求](requirements/index.html) :要求使您可以创建标准来检查产品.
*   [静态站点编辑器](static_site_editor/index.html) :无需事先了解代码库或 Git 命令,即可在静态网站上快速编辑内容.
*   [代码智能](code_intelligence.html) :代码导航功能.

### Project integrations[](#project-integrations "Permalink")

[将您的项目](integrations/index.html)与 Jira,Mattermost,Kubernetes,Slack 等进行[集成](integrations/index.html) .

## New project[](#new-project "Permalink")

了解如何在 GitLab 中[创建一个新项目](../../gitlab-basics/create-project.html) .

### Fork a project[](#fork-a-project "Permalink")

您可以[派生一个项目](repository/forking_workflow.html) ,以便:

*   通过分叉项目并创建从分支到上游项目的合并请求来进行代码协作
*   分叉一个示例项目以在其顶部工作

### Star a project[](#star-a-project "Permalink")

您可以为项目加注星标,以使其更容易找到您经常使用的项目. 项目拥有的明星数量可以表明其受欢迎程度.

为项目加注星标:

1.  转到要加注星标的项目的主页.
2.  在页面的右上角,点击**星标** .

要查看已加星标的项目,请执行以下操作:

1.  单击导航栏中的**项目** .
2.  Click **已加星标的项目**.
3.  GitLab 显示有关已加星标项目的信息,包括:

    *   项目描述,包括名称,描述和图标
    *   已为该项目加注星标的次数
    *   Number of times this project has been forked
    *   打开的合并请求数
    *   未解决问题的数量

### Explore projects[](#explore-projects "Permalink")

您可以探索 GitLab 上可用的其他流行项目. 探索项目:

1.  单击导航栏中的**项目** .
2.  Click **探索项目**.

GitLab 显示一个项目列表,按上次更新日期排序. 要查看具有最多[星星的](#star-a-project)项目,请单击" **最多星星"** . 要查看过去一个月中评论数量最多的项目,请点击**趋势** .

## Project settings[](#project-settings "Permalink")

将项目的可见性级别和访问级别设置为各个页面,并执行诸如归档,重命名或传输项目的操作.

通读有关[项目设置](settings/index.html)的文档.

## Import or export a project[](#import-or-export-a-project "Permalink")

*   [Import a project](import/index.html) from:
    *   [GitHub to GitLab](import/github.html)
    *   [Bitbucket to GitLab](import/bitbucket.html)
    *   [Gitea to GitLab](import/gitea.html)
    *   [FogBugz to GitLab](import/fogbugz.html)
*   [Export a project from GitLab](settings/import_export.html#exporting-a-project-and-its-data)
*   [Importing and exporting projects between GitLab instances](settings/import_export.html)

## Remove a project[](#remove-a-project "Permalink")

要删除项目,请首先导航到该项目的主页.

1.  导航至**设置>常规** .
2.  展开**高级**部分.
3.  向下滚动到" **删除项目"**部分.
4.  Click **移除专案**
5.  通过输入所需的文本来确认此操作.

### Delayed removal[](#delayed-removal-premium "Permalink")

默认情况下,单击以删除项目后会延迟 7 天. 管理员可以在这段时间内恢复项目. [管理员可以更改](../admin_area/settings/visibility_and_access_controls.html#default-deletion-adjourned-period-premium-only)此延迟.

管理员可以查看所有待删除项目. 如果您是管理员,请转到顶部导航栏,单击" **项目">"您的项目"** ,然后选择"已**删除的项目"**选项卡. 管理员可以从此选项卡还原任何项目.

## CI/CD for external repositories[](#cicd-for-external-repositories-premium "Permalink")

您可以将存储库作为 CI / CD 项目连接,而不是将存储库直接导入到 GitLab.

通读[CI / CD 上有关外部存储库](../../ci/ci_cd_for_external_repos/index.html)的文档.

## Project members[](#project-members "Permalink")

了解如何[将成员添加到您的项目中](members/index.html) .

## Project activity[](#project-activity "Permalink")

要查看项目的活动,请导航至**项目概述>活动** . 在此处,您可以单击选项卡以查看**所有**活动,或查看按**Push 事件****Merge 事件****Issue 事件****Comment****Team****Wiki**过滤的**活动** .

### Leave a project[](#leave-a-project "Permalink")

当项目属于组时(在[组命名空间下](../group/index.html#namespaces) ), **离开项目**将仅显示在项目的仪表板上. 如果您选择退出项目,那么您将不再是项目成员,因此无法参与.

## Project’s landing page[](#projects-landing-page "Permalink")

项目的登录页面根据项目的可见性设置和用户权限显示不同的信息.

对于公共项目以及[有权查看该项目代码](../permissions.html#project-members-permissions)的内部和私有项目的成员:

*   显示[`README`文件或索引文件的](repository/#repository-readme-and-index-files)内容(如果有),然后显示项目存储库中的目录列表.
*   如果项目不包含这些文件中的任何一个,则访问者将看到存储库的文件和目录列表.

对于没有权限查看项目代码的用户:

*   显示维基主页(如果有).
*   显示项目中的问题列表.

## Redirects when changing repository paths[](#redirects-when-changing-repository-paths "Permalink")

当存储库路径更改时,从旧位置平稳过渡到新位置至关重要. GitLab 提供两种重定向:Web UI 和 Git 推/拉重定向.

根据情况,可能会有所不同.

When [renaming a user](../profile/index.html#changing-your-username), [changing a group path](../group/index.html#changing-a-groups-path) or [renaming a repository](settings/index.html#renaming-a-repository):

*   名称空间及其下的任何内容(例如项目)的现有 Web URL 将重定向到新 URL.
*   从 GitLab 10.3 开始,命名空间下项目的现有 Git 远程 URL 将重定向到新的远程 URL. 每次将其推/拉到更改位置的存储库时,都会显示一条警告消息,提示您更新遥控器,而不是拒绝操作. 这意味着在重命名后,任何自动化脚本或 Git 客户端将继续工作,从而使任何过渡都更加顺畅.
*   The redirects will be available as long as the original path is not claimed by another group, user or project.

## Use your project as a Go package[](#use-your-project-as-a-go-package "Permalink")

任何项目都可以用作 Go 包. GitLab 会正确响应`go get``godoc.org`发现请求,包括[`go-import`](https://s0golang0org.icopy.site/cmd/go/)[`go-source`](https://github.com/golang/gddo/wiki/Source-Code-Links)元标记.

私有项目(包括子组中的项目)可以用作 Go 包,但可能需要进行配置才能正常工作. 无论身份验证或授权如何,GitLab 都会正确响应以`go get` *不在*子组中的项目的发现请求. 要使用子组中的私有项目作为 Go 包,必须进行[身份验证](#authenticate-go-requests) . 否则,GitLab 会将子组中私有项目的路径截断到前两个段,从而导致`go get`失败.

GitLab 实现了自己的 Go 代理. 此功能必须由管理员启用,并且需要其他配置. 请参阅[GitLab Go 代理](../packages/go_proxy/index.html) .

### Disable Go module features for private projects[](#disable-go-module-features-for-private-projects "Permalink")

In Go 1.12 and later, Go queries module proxies and checksum databases in the process of [fetching a module](../../development/go_guide/dependencies.html#fetching). This can be selectively disabled with `GOPRIVATE` (disable both), [`GONOPROXY`](../../development/go_guide/dependencies.html#proxies) (disable proxy queries), and [`GONOSUMDB`](../../development/go_guide/dependencies.html#fetching) (disable checksum queries).

`GOPRIVATE``GONOPROXY``GONOSUMDB`是 Go 模块和 Go 模块前缀的逗号分隔列表. 例如, `GOPRIVATE=gitlab.example.com/my/private/project`将禁用对该项目的查询,而`GOPRIVATE=gitlab.example.com`将禁用`GOPRIVATE=gitlab.example.com` *所有*项目的查询. 如果模块名称或其前缀出现在`GOPRIVATE``GONOPROXY` ,则 Go 不会查询模块代理. 如果模块名称或其前缀出现在`GONOPRIVATE``GONOSUMDB` ,则 Go 不会查询校验和数据库.

### Authenticate Go requests[](#authenticate-go-requests "Permalink")

要验证对 Go 私有项目的请求,请在密码字段中使用[`.netrc`文件](https://ec.haxx.se/usingcurl-netrc.html)[个人访问令牌](../profile/personal_access_tokens.html) . **仅当可以通过 HTTPS 访问您的 GitLab 实例时,此方法才有效.** `go`命令不会通过不安全的连接传输凭据. 这将验证 Go 直接发出的所有 HTTPS 请求,但不会验证通过 Git 发出的请求.

例如:

```
machine example.gitlab.com
login <gitlab_user_name>
password <personal_access_token> 
```

**注意:**在 Windows 上,Go 读取`~/_netrc`而不是`~/.netrc` .

### Authenticate Git fetches[](#authenticate-git-fetches "Permalink")

如果无法从代理中获取模块,Go 将退回到使用 Git(对于 GitLab 项目). Git 将使用`.netrc`来认证请求. 另外,可以将 Git 配置为在请求 URL 中嵌入特定的凭据,或者使用 SSH 代替 HTTPS(因为 Go 始终使用 HTTPS 来获取 Git 存储库):

```
# embed credentials in any request to GitLab.com:
git config --global url."https://${user}:${personal_access_token}@gitlab.example.com".insteadOf "https://gitlab.example.com"

# use SSH instead of HTTPS:
git config --global url."git@gitlab.example.com".insteadOf "https://gitlab.example.com" 
```

## Access project page with project ID[](#access-project-page-with-project-id "Permalink")

在 GitLab 11.8 中[引入](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/53671) .

要使用项目 ID 从 GitLab UI 快速访问项目,请在浏览器或其他访问项目的工具中访问`/projects/:id` URL.

## Project aliases[](#project-aliases-premium-only "Permalink")

[Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/3264) in [GitLab Premium](https://about.gitlab.com/pricing/) 12.1.

将存储库迁移到 GitLab 并被其他系统访问时,能够使用相同的名称访问它们非常有用,尤其是当它们很多时. 它降低了在大量系统中更改大量 Git URL 的风险.

manbetx 客户端打不开提供了功能来帮助这一点. 在 GitLab 中,通常使用名称空间和项目名称访问存储库. 也可以通过项目别名访问它们. 此功能仅在通过 SSH 的 Git 上可用.

项目别名只能通过 API 创建,并且只能由 GitLab 管理员创建. 有关更多详细信息,请遵循[Project Aliases API 文档](../../api/project_aliases.html) .

一旦为项目创建了别名(例如,项目`https://gitlab.com/gitlab-org/gitlab`的别名`gitlab` ),就可以使用别名(例如`git clone git@gitlab.com:gitlab.git` )来克隆存储库. `git clone git@gitlab.com:gitlab.git`而不是`git clone git@gitlab.com:gitlab-org/gitlab.git` ).

## Project APIs[](#project-apis "Permalink")

您的项目可以使用许多[API](../../api/README.html)

*   [Badges](../../api/project_badges.html)
*   [Clusters](../../api/project_clusters.html)
*   [Threads](../../api/discussions.html)
*   [General](../../api/projects.html)
*   [Import/export](../../api/project_import_export.html)
*   [Issue Board](../../api/boards.html)
*   [Labels](../../api/labels.html)
*   [Markdown](../../api/markdown.html)
*   [Merge Requests](../../api/merge_requests.html)
*   [Milestones](../../api/milestones.html)
*   [Services](../../api/services.html)
*   [Snippets](../../api/project_snippets.html)
*   [Templates](../../api/project_templates.html)
*   [Traffic](../../api/project_statistics.html)
*   [Variables](../../api/project_level_variables.html)
*   [Aliases](../../api/project_aliases.html)