<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                # Projects API > 原文:[https://docs.gitlab.com/ee/api/projects.html](https://docs.gitlab.com/ee/api/projects.html) * [Project visibility level](#project-visibility-level) * [Project merge method](#project-merge-method) * [List all projects](#list-all-projects) * [Pagination limits](#pagination-limits) * [List user projects](#list-user-projects) * [List projects starred by a user](#list-projects-starred-by-a-user) * [Get single project](#get-single-project) * [Get project users](#get-project-users) * [Get project events](#get-project-events) * [Create project](#create-project) * [Create project for user](#create-project-for-user) * [Edit project](#edit-project) * [Fork project](#fork-project) * [List Forks of a project](#list-forks-of-a-project) * [Star a project](#star-a-project) * [Unstar a project](#unstar-a-project) * [List Starrers of a project](#list-starrers-of-a-project) * [Languages](#languages) * [Archive a project](#archive-a-project) * [Unarchive a project](#unarchive-a-project) * [Remove project](#remove-project) * [Restore project marked for deletion](#restore-project-marked-for-deletion-premium) * [Upload a file](#upload-a-file) * [Share project with group](#share-project-with-group) * [Delete a shared project link within a group](#delete-a-shared-project-link-within-a-group) * [Hooks](#hooks) * [List project hooks](#list-project-hooks) * [Get project hook](#get-project-hook) * [Add project hook](#add-project-hook) * [Edit project hook](#edit-project-hook) * [Delete project hook](#delete-project-hook) * [Fork relationship](#fork-relationship) * [Create a forked from/to relation between existing projects](#create-a-forked-fromto-relation-between-existing-projects) * [Delete an existing forked from relationship](#delete-an-existing-forked-from-relationship) * [Search for projects by name](#search-for-projects-by-name) * [Start the Housekeeping task for a Project](#start-the-housekeeping-task-for-a-project) * [Push Rules](#push-rules-starter) * [Get project push rules](#get-project-push-rules) * [Add project push rule](#add-project-push-rule) * [Edit project push rule](#edit-project-push-rule) * [Delete project push rule](#delete-project-push-rule) * [Transfer a project to a new namespace](#transfer-a-project-to-a-new-namespace) * [Branches](#branches) * [Project Import/Export](#project-importexport) * [Project members](#project-members) * [Start the pull mirroring process for a Project](#start-the-pull-mirroring-process-for-a-project-starter) * [Project badges](#project-badges) * [Issue and merge request description templates](#issue-and-merge-request-description-templates) * [Download snapshot of a Git repository](#download-snapshot-of-a-git-repository) # Projects API[](#projects-api "Permalink") ## Project visibility level[](#project-visibility-level "Permalink") GitLab 中的項目可以是私有的,內部的或公共的. 這由項目中的`visibility`字段確定. 項目可見性級別的值為: * `private` :必須為每個用戶顯式授予項目訪問權限. * `internal` :任何登錄的用戶都可以克隆該項目. * `public` :無需任何身份驗證即可訪問該項目. ## Project merge method[](#project-merge-method "Permalink") `merge_method`當前有三個選項可供選擇: * `merge` :為每個合并創建一個合并提交,只要沒有沖突就允許合并. * `rebase_merge` :為每個合并創建一個合并提交,但是僅當可能進行快速合并時才允許合并. 這樣,您可以確保在合并到目標分支后,如果此合并請求將生成,則該請求也將生成. * `ff` :沒有創建合并提交,并且所有合并都被快速轉發,這意味著僅當分支可以被快速轉發時才允許合并. ## List all projects[](#list-all-projects "Permalink") 獲取已認證用戶跨 GitLab 的所有可見項目的列表. 在未經身份驗證的情況下訪問時,僅返回帶有"簡單"字段的公共項目. ``` GET /projects ``` | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `archived` | boolean | no | 受存檔狀態限制 | | `visibility` | string | no | 受`public` , `internal`或`private`可見性的限制 | | `order_by` | string | no | 返回按`id` , `name` , `path` , `created_at` , `updated_at`或`last_activity_at`字段排序的項目. 只有管??理員可以使用`repository_size` , `storage_size`或`wiki_size`字段. 默認為`created_at` | | `sort` | string | no | 返回按`asc`或`desc`順序排序的項目. 默認為`desc` | | `search` | string | no | 返回符合搜索條件的項目列表 | | `search_namespaces` | boolean | no | 匹配搜索條件時包括祖先名稱空間. 默認為`false` | | `simple` | boolean | no | 僅返回每個項目的有限字段. 這是沒有身份驗證的無操作操作,因為這樣*只會*返回簡單的字段. | | `owned` | boolean | no | 受當前用戶明確擁有的項目限制 | | `membership` | boolean | no | 受當前用戶是其成員的項目的限制 | | `starred` | boolean | no | 受當前用戶加注星標的項目限制 | | `statistics` | boolean | no | 包括項目統計 | | `with_custom_attributes` | boolean | no | 在響應中包括[自定義屬性](custom_attributes.html) (僅管理員) | | `with_issues_enabled` | boolean | no | 受啟用的問題限制功能 | | `with_merge_requests_enabled` | boolean | no | 通過啟用的合并請求限制功能 | | `with_programming_language` | string | no | 受使用給定編程語言的項目限制 | | `wiki_checksum_failed` | boolean | no | 限制維基校驗和計算失敗的項目(在[GitLab Premium](https://about.gitlab.com/pricing/) 11.2 中[引入](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/6137) ) | | `repository_checksum_failed` | boolean | no | 限制存儲庫校驗和計算失敗的項目(在[GitLab Premium](https://about.gitlab.com/pricing/) 11.2 中[引入](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/6137) ) | | `min_access_level` | integer | no | 受當前用戶的最小[訪問權限](members.html)限制 | | `id_after` | integer | no | 將結果限制為 ID 大于指定 ID 的項目 | | `id_before` | integer | no | 將結果限制為 ID 小于指定 ID 的項目 | | `last_activity_after` | datetime | no | 在指定時間后,將結果限制為具有 last_activity 的項目. 格式:ISO 8601 YYYY-MM-DDTHH:MM:SSZ | | `last_activity_before` | datetime | no | 將結果限制為在指定時間之前具有 last_activity 的項目. 格式:ISO 8601 YYYY-MM-DDTHH:MM:SSZ | | `repository_storage` | string | no | 將結果限制為存儲在 repository_storage 上的項目. 僅適用于管理員. | **注意:**此端點支持所選`order_by`選項的[鍵集分頁](README.html#keyset-based-pagination) . 當`simple=true`或用戶未經身份驗證時,這將返回如下內容: ``` [ { "id": 4, "description": null, "default_branch": "master", "ssh_url_to_repo": "git@example.com:diaspora/diaspora-client.git", "http_url_to_repo": "http://example.com/diaspora/diaspora-client.git", "web_url": "http://example.com/diaspora/diaspora-client", "readme_url": "http://example.com/diaspora/diaspora-client/blob/master/README.md", "tag_list": [ "example", "disapora client" ], "name": "Diaspora Client", "name_with_namespace": "Diaspora / Diaspora Client", "path": "diaspora-client", "path_with_namespace": "diaspora/diaspora-client", "created_at": "2013-09-30T13:46:02Z", "last_activity_at": "2013-09-30T13:46:02Z", "forks_count": 0, "avatar_url": "http://example.com/uploads/project/avatar/4/uploads/avatar.png", "star_count": 0, }, { "id": 6, "description": null, "default_branch": "master", ... ``` 當用戶通過身份驗證且未設置`simple` ,將返回以下內容: ``` [ { "id": 4, "description": null, "default_branch": "master", "visibility": "private", "ssh_url_to_repo": "git@example.com:diaspora/diaspora-client.git", "http_url_to_repo": "http://example.com/diaspora/diaspora-client.git", "web_url": "http://example.com/diaspora/diaspora-client", "readme_url": "http://example.com/diaspora/diaspora-client/blob/master/README.md", "tag_list": [ "example", "disapora client" ], "owner": { "id": 3, "name": "Diaspora", "created_at": "2013-09-30T13:46:02Z" }, "name": "Diaspora Client", "name_with_namespace": "Diaspora / Diaspora Client", "path": "diaspora-client", "path_with_namespace": "diaspora/diaspora-client", "issues_enabled": true, "open_issues_count": 1, "merge_requests_enabled": true, "jobs_enabled": true, "wiki_enabled": true, "snippets_enabled": false, "can_create_merge_request_in": true, "resolve_outdated_diff_discussions": false, "container_registry_enabled": false, "created_at": "2013-09-30T13:46:02Z", "last_activity_at": "2013-09-30T13:46:02Z", "creator_id": 3, "namespace": { "id": 3, "name": "Diaspora", "path": "diaspora", "kind": "group", "full_path": "diaspora" }, "import_status": "none", "archived": false, "avatar_url": "http://example.com/uploads/project/avatar/4/uploads/avatar.png", "shared_runners_enabled": true, "forks_count": 0, "star_count": 0, "runners_token": "b8547b1dc37721d05889db52fa2f02", "ci_default_git_depth": 50, "public_jobs": true, "shared_with_groups": [], "only_allow_merge_if_pipeline_succeeds": false, "allow_merge_on_skipped_pipeline": false, "only_allow_merge_if_all_discussions_are_resolved": false, "remove_source_branch_after_merge": false, "request_access_enabled": false, "merge_method": "merge", "autoclose_referenced_issues": true, "suggestion_commit_message": null, "marked_for_deletion_at": "2020-04-03", // Deprecated and will be removed in API v5 in favor of marked_for_deletion_on "marked_for_deletion_on": "2020-04-03", "statistics": { "commit_count": 37, "storage_size": 1038090, "repository_size": 1038090, "wiki_size" : 0, "lfs_objects_size": 0, "job_artifacts_size": 0, "packages_size": 0 }, "_links": { "self": "http://example.com/api/v4/projects", "issues": "http://example.com/api/v4/projects/1/issues", "merge_requests": "http://example.com/api/v4/projects/1/merge_requests", "repo_branches": "http://example.com/api/v4/projects/1/repository_branches", "labels": "http://example.com/api/v4/projects/1/labels", "events": "http://example.com/api/v4/projects/1/events", "members": "http://example.com/api/v4/projects/1/members" }, }, { "id": 6, "description": null, "default_branch": "master", "visibility": "private", "ssh_url_to_repo": "git@example.com:brightbox/puppet.git", "http_url_to_repo": "http://example.com/brightbox/puppet.git", "web_url": "http://example.com/brightbox/puppet", "readme_url": "http://example.com/brightbox/puppet/blob/master/README.md", "tag_list": [ "example", "puppet" ], "owner": { "id": 4, "name": "Brightbox", "created_at": "2013-09-30T13:46:02Z" }, "name": "Puppet", "name_with_namespace": "Brightbox / Puppet", "path": "puppet", "path_with_namespace": "brightbox/puppet", "issues_enabled": true, "open_issues_count": 1, "merge_requests_enabled": true, "jobs_enabled": true, "wiki_enabled": true, "snippets_enabled": false, "can_create_merge_request_in": true, "resolve_outdated_diff_discussions": false, "container_registry_enabled": false, "created_at": "2013-09-30T13:46:02Z", "last_activity_at": "2013-09-30T13:46:02Z", "creator_id": 3, "namespace": { "id": 4, "name": "Brightbox", "path": "brightbox", "kind": "group", "full_path": "brightbox" }, "import_status": "none", "import_error": null, "permissions": { "project_access": { "access_level": 10, "notification_level": 3 }, "group_access": { "access_level": 50, "notification_level": 3 } }, "archived": false, "avatar_url": null, "shared_runners_enabled": true, "forks_count": 0, "star_count": 0, "runners_token": "b8547b1dc37721d05889db52fa2f02", "ci_default_git_depth": 0, "public_jobs": true, "shared_with_groups": [], "only_allow_merge_if_pipeline_succeeds": false, "allow_merge_on_skipped_pipeline": false, "only_allow_merge_if_all_discussions_are_resolved": false, "remove_source_branch_after_merge": false, "request_access_enabled": false, "merge_method": "merge", "auto_devops_enabled": true, "auto_devops_deploy_strategy": "continuous", "repository_storage": "default", "approvals_before_merge": 0, "mirror": false, "mirror_user_id": 45, "mirror_trigger_builds": false, "only_mirror_protected_branches": false, "mirror_overwrites_diverged_branches": false, "external_authorization_classification_label": null, "packages_enabled": true, "service_desk_enabled": false, "service_desk_address": null, "autoclose_referenced_issues": true, "suggestion_commit_message": null, "statistics": { "commit_count": 12, "storage_size": 2066080, "repository_size": 2066080, "wiki_size" : 0, "lfs_objects_size": 0, "job_artifacts_size": 0, "packages_size": 0 }, "_links": { "self": "http://example.com/api/v4/projects", "issues": "http://example.com/api/v4/projects/1/issues", "merge_requests": "http://example.com/api/v4/projects/1/merge_requests", "repo_branches": "http://example.com/api/v4/projects/1/repository_branches", "labels": "http://example.com/api/v4/projects/1/labels", "events": "http://example.com/api/v4/projects/1/events", "members": "http://example.com/api/v4/projects/1/members" } } ] ``` **注意:**對于使用 GitLab [Silver,Premium 或更高版本](https://about.gitlab.com/pricing/)的用戶[,](https://about.gitlab.com/pricing/)已不推薦使用`marked_for_deletion_at`屬性,并將在 API v5 中將其刪除,以支持`marked_for_deletion_on`屬性. 在 GitLab 用戶[入門,青銅或更高](https://about.gitlab.com/pricing/)還會看到`approvals_before_merge`參數: ``` [ { "id": 4, "description": null, "approvals_before_merge": 0, ... } ] ``` 您可以使用以下[自定義屬性](custom_attributes.html)進行過濾: ``` GET /projects?custom_attributes[key]=value&custom_attributes[other_key]=other_value ``` ### Pagination limits[](#pagination-limits "Permalink") 從 GitLab 13.0 開始, [基于偏移量的分頁](README.html#offset-based-pagination)將被[限制為 50,000 條記錄](https://gitlab.com/gitlab-org/gitlab/-/issues/34565) . 要檢索超出此限制的項目,將需要進行[鍵集分頁](README.html#keyset-based-pagination) . 請注意,鍵集分頁僅支持`order_by=id` . 其他排序選項不可用. ## List user projects[](#list-user-projects "Permalink") 獲取給定用戶擁有的可見項目的列表. 在未經身份驗證的情況下訪問時,僅返回公共項目. ``` GET /users/:user_id/projects ``` | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `user_id` | string | yes | 用戶的 ID 或用戶名 | | `archived` | boolean | no | 受存檔狀態限制 | | `visibility` | string | no | 受`public` , `internal`或`private`可見性的限制 | | `order_by` | string | no | 返回按`id` , `name` , `path` , `created_at` , `updated_at`或`last_activity_at`字段排序的項目. 默認為`created_at` | | `sort` | string | no | 返回按`asc`或`desc`順序排序的項目. 默認為`desc` | | `search` | string | no | 返回符合搜索條件的項目列表 | | `simple` | boolean | no | 僅返回每個項目的有限字段. 這是沒有身份驗證的無操作操作,因為這樣*只會*返回簡單的字段. | | `owned` | boolean | no | 受當前用戶明確擁有的項目限制 | | `membership` | boolean | no | 受當前用戶是其成員的項目的限制 | | `starred` | boolean | no | Limit by projects starred by the current user | | `statistics` | boolean | no | 包括項目統計 | | `with_custom_attributes` | boolean | no | 在響應中包括[自定義屬性](custom_attributes.html) (僅管理員) | | `with_issues_enabled` | boolean | no | 受啟用的問題限制功能 | | `with_merge_requests_enabled` | boolean | no | 通過啟用的合并請求限制功能 | | `with_programming_language` | string | no | 受使用給定編程語言的項目限制 | | `min_access_level` | integer | no | 受當前用戶的最小[訪問權限](members.html)限制 | | `id_after` | integer | no | 將結果限制為 ID 大于指定 ID 的項目 | | `id_before` | integer | no | 將結果限制為 ID 小于指定 ID 的項目 | **注意:**此端點支持所選`order_by`選項的[鍵集分頁](README.html#keyset-based-pagination) . ``` [ { "id": 4, "description": null, "default_branch": "master", "visibility": "private", "ssh_url_to_repo": "git@example.com:diaspora/diaspora-client.git", "http_url_to_repo": "http://example.com/diaspora/diaspora-client.git", "web_url": "http://example.com/diaspora/diaspora-client", "readme_url": "http://example.com/diaspora/diaspora-client/blob/master/README.md", "tag_list": [ "example", "disapora client" ], "owner": { "id": 3, "name": "Diaspora", "created_at": "2013-09-30T13:46:02Z" }, "name": "Diaspora Client", "name_with_namespace": "Diaspora / Diaspora Client", "path": "diaspora-client", "path_with_namespace": "diaspora/diaspora-client", "issues_enabled": true, "open_issues_count": 1, "merge_requests_enabled": true, "jobs_enabled": true, "wiki_enabled": true, "snippets_enabled": false, "can_create_merge_request_in": true, "resolve_outdated_diff_discussions": false, "container_registry_enabled": false, "created_at": "2013-09-30T13:46:02Z", "last_activity_at": "2013-09-30T13:46:02Z", "creator_id": 3, "namespace": { "id": 3, "name": "Diaspora", "path": "diaspora", "kind": "group", "full_path": "diaspora" }, "import_status": "none", "archived": false, "avatar_url": "http://example.com/uploads/project/avatar/4/uploads/avatar.png", "shared_runners_enabled": true, "forks_count": 0, "star_count": 0, "runners_token": "b8547b1dc37721d05889db52fa2f02", "ci_default_git_depth": 50, "public_jobs": true, "shared_with_groups": [], "only_allow_merge_if_pipeline_succeeds": false, "allow_merge_on_skipped_pipeline": false, "only_allow_merge_if_all_discussions_are_resolved": false, "remove_source_branch_after_merge": false, "request_access_enabled": false, "merge_method": "merge", "autoclose_referenced_issues": true, "suggestion_commit_message": null, "marked_for_deletion_at": "2020-04-03", // Deprecated and will be removed in API v5 in favor of marked_for_deletion_on "marked_for_deletion_on": "2020-04-03", "statistics": { "commit_count": 37, "storage_size": 1038090, "repository_size": 1038090, "wiki_size" : 0, "lfs_objects_size": 0, "job_artifacts_size": 0, "packages_size": 0 }, "_links": { "self": "http://example.com/api/v4/projects", "issues": "http://example.com/api/v4/projects/1/issues", "merge_requests": "http://example.com/api/v4/projects/1/merge_requests", "repo_branches": "http://example.com/api/v4/projects/1/repository_branches", "labels": "http://example.com/api/v4/projects/1/labels", "events": "http://example.com/api/v4/projects/1/events", "members": "http://example.com/api/v4/projects/1/members" } }, { "id": 6, "description": null, "default_branch": "master", "visibility": "private", "ssh_url_to_repo": "git@example.com:brightbox/puppet.git", "http_url_to_repo": "http://example.com/brightbox/puppet.git", "web_url": "http://example.com/brightbox/puppet", "readme_url": "http://example.com/brightbox/puppet/blob/master/README.md", "tag_list": [ "example", "puppet" ], "owner": { "id": 4, "name": "Brightbox", "created_at": "2013-09-30T13:46:02Z" }, "name": "Puppet", "name_with_namespace": "Brightbox / Puppet", "path": "puppet", "path_with_namespace": "brightbox/puppet", "issues_enabled": true, "open_issues_count": 1, "merge_requests_enabled": true, "jobs_enabled": true, "wiki_enabled": true, "snippets_enabled": false, "can_create_merge_request_in": true, "resolve_outdated_diff_discussions": false, "container_registry_enabled": false, "created_at": "2013-09-30T13:46:02Z", "last_activity_at": "2013-09-30T13:46:02Z", "creator_id": 3, "namespace": { "id": 4, "name": "Brightbox", "path": "brightbox", "kind": "group", "full_path": "brightbox" }, "import_status": "none", "import_error": null, "permissions": { "project_access": { "access_level": 10, "notification_level": 3 }, "group_access": { "access_level": 50, "notification_level": 3 } }, "archived": false, "avatar_url": null, "shared_runners_enabled": true, "forks_count": 0, "star_count": 0, "runners_token": "b8547b1dc37721d05889db52fa2f02", "ci_default_git_depth": 0, "public_jobs": true, "shared_with_groups": [], "only_allow_merge_if_pipeline_succeeds": false, "allow_merge_on_skipped_pipeline": false, "only_allow_merge_if_all_discussions_are_resolved": false, "remove_source_branch_after_merge": false, "request_access_enabled": false, "merge_method": "merge", "auto_devops_enabled": true, "auto_devops_deploy_strategy": "continuous", "repository_storage": "default", "approvals_before_merge": 0, "mirror": false, "mirror_user_id": 45, "mirror_trigger_builds": false, "only_mirror_protected_branches": false, "mirror_overwrites_diverged_branches": false, "external_authorization_classification_label": null, "packages_enabled": true, "service_desk_enabled": false, "service_desk_address": null, "autoclose_referenced_issues": true, "suggestion_commit_message": null, "statistics": { "commit_count": 12, "storage_size": 2066080, "repository_size": 2066080, "wiki_size" : 0, "lfs_objects_size": 0, "job_artifacts_size": 0, "packages_size": 0 }, "_links": { "self": "http://example.com/api/v4/projects", "issues": "http://example.com/api/v4/projects/1/issues", "merge_requests": "http://example.com/api/v4/projects/1/merge_requests", "repo_branches": "http://example.com/api/v4/projects/1/repository_branches", "labels": "http://example.com/api/v4/projects/1/labels", "events": "http://example.com/api/v4/projects/1/events", "members": "http://example.com/api/v4/projects/1/members" } } ] ``` ## List projects starred by a user[](#list-projects-starred-by-a-user "Permalink") 獲取給定用戶擁有的可見項目的列表. 在未經身份驗證的情況下訪問時,僅返回公共項目. ``` GET /users/:user_id/starred_projects ``` | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `user_id` | string | yes | 用戶的 ID 或用戶名. | | `archived` | boolean | no | 受存檔狀態限制. | | `visibility` | string | no | 受`public` , `internal`或`private`可見性的限制. | | `order_by` | string | no | 返回按`id` , `name` , `path` , `created_at` , `updated_at`或`last_activity_at`字段排序的項目. 默認值為`created_at` . | | `sort` | string | no | 返回按`asc`或`desc`順序排序的項目. 默認為`desc` . | | `search` | string | no | 返回符合搜索條件的項目列表. | | `simple` | boolean | no | 僅返回每個項目的有限字段. 這是沒有身份驗證的無操作操作,因為*僅*返回簡單字段. | | `owned` | boolean | no | 受當前用戶明確擁有的項目限制. | | `membership` | boolean | no | 受當前用戶所屬項目的限制. | | `starred` | boolean | no | 受當前用戶加注星標的項目限制. | | `statistics` | boolean | no | 包括項目統計信息. | | `with_custom_attributes` | boolean | no | 在響應中包括[自定義屬性](custom_attributes.html) (僅管理員). | | `with_issues_enabled` | boolean | no | 受啟用的問題限制功能. | | `with_merge_requests_enabled` | boolean | no | 通過啟用的合并請求限制功能. | | `min_access_level` | integer | no | 受當前用戶的最小[訪問權限](members.html)限制. | ``` curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/users/5/starred_projects" ``` 響應示例: ``` [ { "id": 4, "description": null, "default_branch": "master", "visibility": "private", "ssh_url_to_repo": "git@example.com:diaspora/diaspora-client.git", "http_url_to_repo": "http://example.com/diaspora/diaspora-client.git", "web_url": "http://example.com/diaspora/diaspora-client", "readme_url": "http://example.com/diaspora/diaspora-client/blob/master/README.md", "tag_list": [ "example", "disapora client" ], "owner": { "id": 3, "name": "Diaspora", "created_at": "2013-09-30T13:46:02Z" }, "name": "Diaspora Client", "name_with_namespace": "Diaspora / Diaspora Client", "path": "diaspora-client", "path_with_namespace": "diaspora/diaspora-client", "issues_enabled": true, "open_issues_count": 1, "merge_requests_enabled": true, "jobs_enabled": true, "wiki_enabled": true, "snippets_enabled": false, "can_create_merge_request_in": true, "resolve_outdated_diff_discussions": false, "container_registry_enabled": false, "created_at": "2013-09-30T13:46:02Z", "last_activity_at": "2013-09-30T13:46:02Z", "creator_id": 3, "namespace": { "id": 3, "name": "Diaspora", "path": "diaspora", "kind": "group", "full_path": "diaspora" }, "import_status": "none", "archived": false, "avatar_url": "http://example.com/uploads/project/avatar/4/uploads/avatar.png", "shared_runners_enabled": true, "forks_count": 0, "star_count": 0, "runners_token": "b8547b1dc37721d05889db52fa2f02", "public_jobs": true, "shared_with_groups": [], "only_allow_merge_if_pipeline_succeeds": false, "allow_merge_on_skipped_pipeline": false, "only_allow_merge_if_all_discussions_are_resolved": false, "remove_source_branch_after_merge": false, "request_access_enabled": false, "merge_method": "merge", "autoclose_referenced_issues": true, "suggestion_commit_message": null, "statistics": { "commit_count": 37, "storage_size": 1038090, "repository_size": 1038090, "lfs_objects_size": 0, "job_artifacts_size": 0 }, "_links": { "self": "http://example.com/api/v4/projects", "issues": "http://example.com/api/v4/projects/1/issues", "merge_requests": "http://example.com/api/v4/projects/1/merge_requests", "repo_branches": "http://example.com/api/v4/projects/1/repository_branches", "labels": "http://example.com/api/v4/projects/1/labels", "events": "http://example.com/api/v4/projects/1/events", "members": "http://example.com/api/v4/projects/1/members" } }, { "id": 6, "description": null, "default_branch": "master", "visibility": "private", "ssh_url_to_repo": "git@example.com:brightbox/puppet.git", "http_url_to_repo": "http://example.com/brightbox/puppet.git", "web_url": "http://example.com/brightbox/puppet", "readme_url": "http://example.com/brightbox/puppet/blob/master/README.md", "tag_list": [ "example", "puppet" ], "owner": { "id": 4, "name": "Brightbox", "created_at": "2013-09-30T13:46:02Z" }, "name": "Puppet", "name_with_namespace": "Brightbox / Puppet", "path": "puppet", "path_with_namespace": "brightbox/puppet", "issues_enabled": true, "open_issues_count": 1, "merge_requests_enabled": true, "jobs_enabled": true, "wiki_enabled": true, "snippets_enabled": false, "can_create_merge_request_in": true, "resolve_outdated_diff_discussions": false, "container_registry_enabled": false, "created_at": "2013-09-30T13:46:02Z", "last_activity_at": "2013-09-30T13:46:02Z", "creator_id": 3, "namespace": { "id": 4, "name": "Brightbox", "path": "brightbox", "kind": "group", "full_path": "brightbox" }, "import_status": "none", "import_error": null, "permissions": { "project_access": { "access_level": 10, "notification_level": 3 }, "group_access": { "access_level": 50, "notification_level": 3 } }, "archived": false, "avatar_url": null, "shared_runners_enabled": true, "forks_count": 0, "star_count": 0, "runners_token": "b8547b1dc37721d05889db52fa2f02", "public_jobs": true, "shared_with_groups": [], "only_allow_merge_if_pipeline_succeeds": false, "allow_merge_on_skipped_pipeline": false, "only_allow_merge_if_all_discussions_are_resolved": false, "remove_source_branch_after_merge": false, "request_access_enabled": false, "merge_method": "merge", "auto_devops_enabled": true, "auto_devops_deploy_strategy": "continuous", "repository_storage": "default", "approvals_before_merge": 0, "mirror": false, "mirror_user_id": 45, "mirror_trigger_builds": false, "only_mirror_protected_branches": false, "mirror_overwrites_diverged_branches": false, "external_authorization_classification_label": null, "packages_enabled": true, "service_desk_enabled": false, "service_desk_address": null, "autoclose_referenced_issues": true, "suggestion_commit_message": null, "statistics": { "commit_count": 12, "storage_size": 2066080, "repository_size": 2066080, "lfs_objects_size": 0, "job_artifacts_size": 0 }, "_links": { "self": "http://example.com/api/v4/projects", "issues": "http://example.com/api/v4/projects/1/issues", "merge_requests": "http://example.com/api/v4/projects/1/merge_requests", "repo_branches": "http://example.com/api/v4/projects/1/repository_branches", "labels": "http://example.com/api/v4/projects/1/labels", "events": "http://example.com/api/v4/projects/1/events", "members": "http://example.com/api/v4/projects/1/members" } } ] ``` ## Get single project[](#get-single-project "Permalink") 獲取一個特定的項目. 如果可以公開訪問該項目,則無需身份驗證即可訪問該端點. ``` GET /projects/:id ``` | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `id` | integer/string | yes | 項目的 ID 或[URL 編碼的路徑](README.html#namespaced-path-encoding) | | `statistics` | boolean | no | 包括項目統計 | | `license` | boolean | no | 包括項目許可證數據 | | `with_custom_attributes` | boolean | no | 在響應中包括[自定義屬性](custom_attributes.html) (僅管理員) | ``` { "id": 3, "description": null, "default_branch": "master", "visibility": "private", "ssh_url_to_repo": "git@example.com:diaspora/diaspora-project-site.git", "http_url_to_repo": "http://example.com/diaspora/diaspora-project-site.git", "web_url": "http://example.com/diaspora/diaspora-project-site", "readme_url": "http://example.com/diaspora/diaspora-project-site/blob/master/README.md", "tag_list": [ "example", "disapora project" ], "owner": { "id": 3, "name": "Diaspora", "created_at": "2013-09-30T13:46:02Z" }, "name": "Diaspora Project Site", "name_with_namespace": "Diaspora / Diaspora Project Site", "path": "diaspora-project-site", "path_with_namespace": "diaspora/diaspora-project-site", "issues_enabled": true, "open_issues_count": 1, "merge_requests_enabled": true, "jobs_enabled": true, "wiki_enabled": true, "snippets_enabled": false, "can_create_merge_request_in": true, "resolve_outdated_diff_discussions": false, "container_registry_enabled": false, "container_expiration_policy": { "cadence": "7d", "enabled": false, "keep_n": null, "older_than": null, "name_regex": null, // to be deprecated in GitLab 13.0 in favor of `name_regex_delete` "name_regex_delete": null, "name_regex_keep": null, "next_run_at": "2020-01-07T21:42:58.658Z" }, "created_at": "2013-09-30T13:46:02Z", "last_activity_at": "2013-09-30T13:46:02Z", "creator_id": 3, "namespace": { "id": 3, "name": "Diaspora", "path": "diaspora", "kind": "group", "full_path": "diaspora", "avatar_url": "http://localhost:3000/uploads/group/avatar/3/foo.jpg", "web_url": "http://localhost:3000/groups/diaspora" }, "import_status": "none", "import_error": null, "permissions": { "project_access": { "access_level": 10, "notification_level": 3 }, "group_access": { "access_level": 50, "notification_level": 3 } }, "archived": false, "avatar_url": "http://example.com/uploads/project/avatar/3/uploads/avatar.png", "license_url": "http://example.com/diaspora/diaspora-client/blob/master/LICENSE", "license": { "key": "lgpl-3.0", "name": "GNU Lesser General Public License v3.0", "nickname": "GNU LGPLv3", "html_url": "http://choosealicense.com/licenses/lgpl-3.0/", "source_url": "http://www.gnu.org/licenses/lgpl-3.0.txt" }, "shared_runners_enabled": true, "forks_count": 0, "star_count": 0, "runners_token": "b8bc4a7a29eb76ea83cf79e4908c2b", "ci_default_git_depth": 50, "public_jobs": true, "shared_with_groups": [ { "group_id": 4, "group_name": "Twitter", "group_full_path": "twitter", "group_access_level": 30 }, { "group_id": 3, "group_name": "Gitlab Org", "group_full_path": "gitlab-org", "group_access_level": 10 } ], "repository_storage": "default", "only_allow_merge_if_pipeline_succeeds": false, "allow_merge_on_skipped_pipeline": false, "only_allow_merge_if_all_discussions_are_resolved": false, "remove_source_branch_after_merge": false, "printing_merge_requests_link_enabled": true, "request_access_enabled": false, "merge_method": "merge", "auto_devops_enabled": true, "auto_devops_deploy_strategy": "continuous", "repository_storage": "default", "approvals_before_merge": 0, "mirror": false, "mirror_user_id": 45, "mirror_trigger_builds": false, "only_mirror_protected_branches": false, "mirror_overwrites_diverged_branches": false, "external_authorization_classification_label": null, "packages_enabled": true, "service_desk_enabled": false, "service_desk_address": null, "autoclose_referenced_issues": true, "suggestion_commit_message": null, "marked_for_deletion_at": "2020-04-03", // Deprecated and will be removed in API v5 in favor of marked_for_deletion_on "marked_for_deletion_on": "2020-04-03", "compliance_frameworks": [ "sox" ], "statistics": { "commit_count": 37, "storage_size": 1038090, "repository_size": 1038090, "wiki_size" : 0, "lfs_objects_size": 0, "job_artifacts_size": 0, "packages_size": 0 }, "_links": { "self": "http://example.com/api/v4/projects", "issues": "http://example.com/api/v4/projects/1/issues", "merge_requests": "http://example.com/api/v4/projects/1/merge_requests", "repo_branches": "http://example.com/api/v4/projects/1/repository_branches", "labels": "http://example.com/api/v4/projects/1/labels", "events": "http://example.com/api/v4/projects/1/events", "members": "http://example.com/api/v4/projects/1/members" } } ``` 在 GitLab 用戶[入門,青銅或更高](https://about.gitlab.com/pricing/)還會看到`approvals_before_merge`參數: ``` { "id": 3, "description": null, "approvals_before_merge": 0, ... } ``` **注意** :GitLab 11.11 中[引入](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/27427)了`namespace`上的`web_url`和`avatar_url`屬性. 如果項目是 fork,并且您提供了有效的令牌進行身份驗證,則`forked_from_project`字段將出現在響應中. ``` { "id":3, ... "forked_from_project":{ "id":13083, "description":"GitLab Community Edition", "name":"GitLab Community Edition", "name_with_namespace":"GitLab.org / GitLab Community Edition", "path":"gitlab-foss", "path_with_namespace":"gitlab-org/gitlab-foss", "created_at":"2013-09-26T06:02:36.000Z", "default_branch":"master", "tag_list":[], "ssh_url_to_repo":"git@gitlab.com:gitlab-org/gitlab-foss.git", "http_url_to_repo":"https://gitlab.com/gitlab-org/gitlab-foss.git", "web_url":"https://gitlab.com/gitlab-org/gitlab-foss", "avatar_url":"https://assets.gitlab-static.net/uploads/-/system/project/avatar/13083/logo-extra-whitespace.png", "license_url": "https://gitlab.com/gitlab-org/gitlab/blob/master/LICENSE", "license": { "key": "mit", "name": "MIT License", "nickname": null, "html_url": "http://choosealicense.com/licenses/mit/", "source_url": "https://opensource.org/licenses/MIT", }, "star_count":3812, "forks_count":3561, "last_activity_at":"2018-01-02T11:40:26.570Z", "namespace": { "id": 72, "name": "GitLab.org", "path": "gitlab-org", "kind": "group", "full_path": "gitlab-org", "parent_id": null } } ... } ``` ## Get project users[](#get-project-users "Permalink") 獲取項目的用戶列表. ``` GET /projects/:id/users ``` | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `id` | integer/string | yes | 項目的 ID 或[URL 編碼的路徑](README.html#namespaced-path-encoding) | | `search` | string | no | 搜索特定用戶 | | `skip_users` | 整數數組 | no | 篩選出具有指定 ID 的用戶 | ``` [ { "id": 1, "username": "john_smith", "name": "John Smith", "state": "active", "avatar_url": "http://localhost:3000/uploads/user/avatar/1/cd8.jpeg", "web_url": "http://localhost:3000/john_smith" }, { "id": 2, "username": "jack_smith", "name": "Jack Smith", "state": "blocked", "avatar_url": "http://gravatar.com/../e32131cd8.jpeg", "web_url": "http://localhost:3000/jack_smith" } ] ``` ## Get project events[](#get-project-events "Permalink") 請參考[Events API 文檔](events.html#list-a-projects-visible-events) . ## Create project[](#create-project "Permalink") 創建一個經過身份驗證的用戶擁有的新項目. ``` POST /projects ``` | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `name` | string | 是,如果未提供路徑 | 新項目的名稱. 如果未提供,則等于路徑. | | `path` | string | 是,如果未提供名稱 | 新項目的存儲庫名稱. 如果未提供,則根據名稱生成(生成的小寫字母加短劃線). | | `namespace_id` | integer | no | 新項目的命名空間(默認為當前用戶的命名空間) | | `default_branch` | string | no | `master`默認 | | `description` | string | no | 簡短的項目說明 | | `issues_enabled` | boolean | no | (不建議使用)為此項目啟用問題. 改用`issues_access_level` | | `merge_requests_enabled` | boolean | no | (不建議使用)為此項目啟用合并請求. 改用`merge_requests_access_level` | | `jobs_enabled` | boolean | no | (不建議使用)為此項目啟用作業. 改用`builds_access_level` | | `wiki_enabled` | boolean | no | (已棄用)為此項目啟用 Wiki. 改用`wiki_access_level` | | `snippets_enabled` | boolean | no | (不建議使用)為此項目啟用摘要. 請改用`snippets_access_level` | | `issues_access_level` | string | no | `disabled` , `private`或`enabled` | | `repository_access_level` | string | no | `disabled` , `private`或`enabled` | | `merge_requests_access_level` | string | no | `disabled` , `private`或`enabled` | | `forking_access_level` | string | no | `disabled` , `private`或`enabled` | | `builds_access_level` | string | no | `disabled` , `private`或`enabled` | | `wiki_access_level` | string | no | `disabled` , `private`或`enabled` | | `snippets_access_level` | string | no | `disabled` , `private`或`enabled` | | `pages_access_level` | string | no | `disabled` , `private` , `enabled`或`public` | | `emails_disabled` | boolean | no | 禁用電子郵件通知 | | `show_default_award_emojis` | boolean | no | 顯示默認的獎勵表情符號 | | `resolve_outdated_diff_discussions` | boolean | no | 自動解決合并請求差異討論(通過推送更改) | | `container_registry_enabled` | boolean | no | 為該項目啟用容器注冊表 | | `container_expiration_policy_attributes` | hash | no | 更新此項目的圖像過期策略. 接受: `cadence` (字符串), `keep_n` (字符串), `older_than` (字符串), `name_regex` (字符串), `name_regex_delete` (字符串), `name_regex_keep` (字符串), `enabled` (布爾值) | | `shared_runners_enabled` | boolean | no | 為此項目啟用共享跑步者 | | `visibility` | string | no | See [project visibility level](#project-visibility-level) | | `import_url` | string | no | 從中導入存儲庫的 URL | | `public_builds` | boolean | no | 如果為`true` ,則非項目成員可以查看作業 | | `only_allow_merge_if_pipeline_succeeds` | boolean | no | 設置是否只能將合并請求與成功的作業合并 | | `allow_merge_on_skipped_pipeline` | boolean | no | 設置是否可以將合并請求與跳過的作業合并 | | `only_allow_merge_if_all_discussions_are_resolved` | boolean | no | 設置是否僅在所有討論都解決后才能合并合并請求 | | `merge_method` | string | no | 設置使用的[合并方法](#project-merge-method) | | `autoclose_referenced_issues` | boolean | no | 設置是否自動關閉默認分支上的引用問題 | | `remove_source_branch_after_merge` | boolean | no | 默認情況下,為所有新合并請求啟用" `Delete source branch`選項 | | `lfs_enabled` | boolean | no | 啟用 LFS | | `request_access_enabled` | boolean | no | 允許用戶請求成員訪問 | | `tag_list` | array | no | 項目標簽列表; 放置標簽數組,這些標簽應最終分配給項目 | | `avatar` | mixed | no | 項目頭像的圖像文件 | | `printing_merge_request_link_enabled` | boolean | no | 從命令行推送時顯示創建/查看合并請求的鏈接 | | `build_git_strategy` | string | no | Git 策略. 默認為`fetch` | | `build_timeout` | integer | no | 作業可以運行的最長時間(以分鐘為單位)(以秒為單位) | | `auto_cancel_pending_pipelines` | string | no | 自動取消掛起的管道(注意:這不是布爾值,但已啟用/禁用 | | `build_coverage_regex` | string | no | 測試覆蓋率解析 | | `ci_config_path` | string | no | CI 配置文件的路徑 | | `auto_devops_enabled` | boolean | no | 為該項目啟用 Auto DevOps | | `auto_devops_deploy_strategy` | string | no | 自動部署策略( `continuous` , `manual`或`timed_incremental` ) | | `repository_storage` | string | no | 存儲庫位于哪個存儲分片上. 僅適用于管理員 | | `approvals_before_merge` | integer | no | 默認情況下,應有多少個批準者批準合并請求 | | `external_authorization_classification_label` | string | no | 項目的分類標簽 | | `mirror` | boolean | no | 在項目中啟用拉鏡像 | | `mirror_trigger_builds` | boolean | no | 拉鏡像觸發器構建 | | `initialize_with_readme` | boolean | no | 默認為`false` | | `template_name` | string | no | 不使用`use_custom_template` ,為[內置項目模板的名稱](../gitlab-basics/create-project.html#built-in-templates) . 與`use_custom_template`使用時,自定義項目模板的名稱 | | `template_project_id` | integer | no | 與`use_custom_template`使用時,是自定義項目模板的項目 ID. 這比使用`template_name`更可取,因為`template_name`可能含糊. | | `use_custom_template` | boolean | no | 使用自定義[實例](../user/admin_area/custom_project_templates.html)或[組](../user/group/custom_project_templates.html) (帶有`group_with_project_templates_id` )項目模板 | | `group_with_project_templates_id` | integer | no | 對于組級別的自定義模板,指定所有自定義項目模板所源自的組的 ID. 將實例級模板留空. 要求`use_custom_template`為 true | | `packages_enabled` | boolean | no | 啟用或禁用軟件包存儲庫功能 | **注意:**如果您的 HTTP 存儲庫不可公開訪問,請將身份驗證信息添加到 URL: `https://username:password@gitlab.company.com/group/project.git` ,其中`password`是啟用了`api`范圍的公共訪問密鑰. ## Create project for user[](#create-project-for-user "Permalink") 創建一個由指定用戶擁有的新項目. 僅適用于管理員. ``` POST /projects/user/:user_id ``` | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `user_id` | integer | yes | 項目所有者的用戶標識 | | `name` | string | yes | 新項目的名稱 | | `path` | string | no | 新項目的自定義存儲庫名稱. 默認情況下根據名稱生成 | | `namespace_id` | integer | no | Namespace for the new project (defaults to the current user’s namespace) | | `description` | string | no | 簡短的項目說明 | | `issues_enabled` | boolean | no | (不建議使用)為此項目啟用問題. 改用`issues_access_level` | | `merge_requests_enabled` | boolean | no | (不建議使用)為此項目啟用合并請求. 改用`merge_requests_access_level` | | `jobs_enabled` | boolean | no | (不建議使用)為此項目啟用作業. 改用`builds_access_level` | | `wiki_enabled` | boolean | no | (已棄用)為此項目啟用 Wiki. 改用`wiki_access_level` | | `snippets_enabled` | boolean | no | (不建議使用)為此項目啟用摘要. 請改用`snippets_access_level` | | `issues_access_level` | string | no | `disabled` , `private`或`enabled` | | `repository_access_level` | string | no | `disabled` , `private`或`enabled` | | `merge_requests_access_level` | string | no | `disabled` , `private`或`enabled` | | `forking_access_level` | string | no | `disabled` , `private`或`enabled` | | `builds_access_level` | string | no | `disabled` , `private`或`enabled` | | `wiki_access_level` | string | no | `disabled` , `private`或`enabled` | | `snippets_access_level` | string | no | `disabled` , `private`或`enabled` | | `pages_access_level` | string | no | `disabled` , `private` , `enabled`或`public` | | `emails_disabled` | boolean | no | 禁用電子郵件通知 | | `show_default_award_emojis` | boolean | no | 顯示默認的獎勵表情符號 | | `resolve_outdated_diff_discussions` | boolean | no | 自動解決合并請求差異討論(通過推送更改) | | `container_registry_enabled` | boolean | no | 為該項目啟用容器注冊表 | | `shared_runners_enabled` | boolean | no | 為此項目啟用共享跑步者 | | `visibility` | string | no | See [project visibility level](#project-visibility-level) | | `import_url` | string | no | 從中導入存儲庫的 URL | | `public_builds` | boolean | no | 如果為`true` ,則非項目成員可以查看作業 | | `only_allow_merge_if_pipeline_succeeds` | boolean | no | 設置是否只能將合并請求與成功的作業合并 | | `allow_merge_on_skipped_pipeline` | boolean | no | 設置是否可以將合并請求與跳過的作業合并 | | `only_allow_merge_if_all_discussions_are_resolved` | boolean | no | 設置是否僅在所有討論都解決后才能合并合并請求 | | `merge_method` | string | no | 設置使用的[合并方法](#project-merge-method) | | `autoclose_referenced_issues` | boolean | no | 設置是否自動關閉默認分支上的引用問題 | | `suggestion_commit_message` | string | no | 用于應用合并請求建議的提交消息 | | `remove_source_branch_after_merge` | boolean | no | 默認情況下,為所有新合并請求啟用" `Delete source branch`選項 | | `lfs_enabled` | boolean | no | 啟用 LFS | | `request_access_enabled` | boolean | no | 允許用戶請求成員訪問 | | `tag_list` | array | no | 項目標簽列表; 放置標簽數組,這些標簽應最終分配給項目 | | `avatar` | mixed | no | 項目頭像的圖像文件 | | `printing_merge_request_link_enabled` | boolean | no | 從命令行推送時顯示創建/查看合并請求的鏈接 | | `build_git_strategy` | string | no | Git 策略. 默認為`fetch` | | `build_timeout` | integer | no | 作業可以運行的最長時間(以分鐘為單位)(以秒為單位) | | `auto_cancel_pending_pipelines` | string | no | 自動取消掛起的管道(注意:這不是布爾值,但已啟用/禁用 | | `build_coverage_regex` | string | no | 測試覆蓋率解析 | | `ci_config_path` | string | no | CI 配置文件的路徑 | | `auto_devops_enabled` | boolean | no | 為該項目啟用 Auto DevOps | | `auto_devops_deploy_strategy` | string | no | 自動部署策略( `continuous` , `manual`或`timed_incremental` ) | | `repository_storage` | string | no | 存儲庫位于哪個存儲分片上. 僅適用于管理員 | | `approvals_before_merge` | integer | no | 默認情況下,應有多少個批準者批準合并請求 | | `external_authorization_classification_label` | string | no | 項目的分類標簽 | | `mirror` | boolean | no | 在項目中啟用拉鏡像 | | `mirror_trigger_builds` | boolean | no | 拉鏡像觸發器構建 | | `initialize_with_readme` | boolean | no | 默認為`false` | | `template_name` | string | no | 不使用`use_custom_template` ,為[內置項目模板的名稱](../gitlab-basics/create-project.html#built-in-templates) . 與`use_custom_template`使用時,自定義項目模板的名稱 | | `use_custom_template` | boolean | no | Use either custom [instance](../user/admin_area/custom_project_templates.html) or [group](../user/group/custom_project_templates.html) (with `group_with_project_templates_id`) project template | | `group_with_project_templates_id` | integer | no | 對于組級別的自定義模板,指定所有自定義項目模板所源自的組的 ID. 將實例級模板留空. 要求`use_custom_template`為 true | | `packages_enabled` | boolean | no | 啟用或禁用軟件包存儲庫功能 | **注意:**如果您的 HTTP 存儲庫不可公開訪問,請將身份驗證信息添加到 URL: `https://username:password@gitlab.company.com/group/project.git` ,其中`password`是啟用了`api`范圍的公共訪問密鑰. ## Edit project[](#edit-project "Permalink") 更新現有項目. ``` PUT /projects/:id ``` | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `id` | integer/string | yes | 項目的 ID 或[URL 編碼的路徑](README.html#namespaced-path-encoding) | | `name` | string | no | 項目名稱 | | `path` | string | no | 項目的自定義存儲庫名稱. 默認情況下根據名稱生成 | | `default_branch` | string | no | `master`默認 | | `description` | string | no | 簡短的項目說明 | | `issues_enabled` | boolean | no | (不建議使用)為此項目啟用問題. 改用`issues_access_level` | | `merge_requests_enabled` | boolean | no | (不建議使用)為此項目啟用合并請求. 改用`merge_requests_access_level` | | `jobs_enabled` | boolean | no | (不建議使用)為此項目啟用作業. 改用`builds_access_level` | | `wiki_enabled` | boolean | no | (已棄用)為此項目啟用 Wiki. 改用`wiki_access_level` | | `snippets_enabled` | boolean | no | (不建議使用)為此項目啟用摘要. 請改用`snippets_access_level` | | `issues_access_level` | string | no | `disabled` , `private`或`enabled` | | `repository_access_level` | string | no | `disabled` , `private`或`enabled` | | `merge_requests_access_level` | string | no | `disabled` , `private`或`enabled` | | `forking_access_level` | string | no | `disabled` , `private`或`enabled` | | `builds_access_level` | string | no | `disabled` , `private`或`enabled` | | `wiki_access_level` | string | no | `disabled` , `private`或`enabled` | | `snippets_access_level` | string | no | `disabled` , `private`或`enabled` | | `pages_access_level` | string | no | `disabled` , `private` , `enabled`或`public` | | `emails_disabled` | boolean | no | 禁用電子郵件通知 | | `show_default_award_emojis` | boolean | no | 顯示默認的獎勵表情符號 | | `resolve_outdated_diff_discussions` | boolean | no | 自動解決合并請求差異討論(通過推送更改) | | `container_registry_enabled` | boolean | no | 為該項目啟用容器注冊表 | | `container_expiration_policy_attributes` | hash | no | 更新此項目的圖像過期策略. 接受: `cadence` (字符串), `keep_n` (字符串), `older_than` (字符串), `name_regex` (字符串), `name_regex_delete` (字符串), `name_regex_keep` (字符串), `enabled` (布爾值) | | `shared_runners_enabled` | boolean | no | 為此項目啟用共享跑步者 | | `visibility` | string | no | See [project visibility level](#project-visibility-level) | | `import_url` | string | no | 從中導入存儲庫的 URL | | `public_builds` | boolean | no | 如果為`true` ,則非項目成員可以查看作業 | | `only_allow_merge_if_pipeline_succeeds` | boolean | no | 設置是否只能將合并請求與成功的作業合并 | | `allow_merge_on_skipped_pipeline` | boolean | no | 設置是否可以將合并請求與跳過的作業合并 | | `only_allow_merge_if_all_discussions_are_resolved` | boolean | no | 設置是否僅在所有討論都解決后才能合并合并請求 | | `merge_method` | string | no | 設置使用的[合并方法](#project-merge-method) | | `autoclose_referenced_issues` | boolean | no | 設置是否自動關閉默認分支上的引用問題 | | `suggestion_commit_message` | string | no | 用于應用合并請求建議的提交消息 | | `remove_source_branch_after_merge` | boolean | no | 默認情況下,為所有新合并請求啟用" `Delete source branch`選項 | | `lfs_enabled` | boolean | no | 啟用 LFS | | `request_access_enabled` | boolean | no | 允許用戶請求成員訪問 | | `tag_list` | array | no | 項目標簽列表; 放置標簽數組,這些標簽應最終分配給項目 | | `avatar` | mixed | no | 項目頭像的圖像文件 | | `build_git_strategy` | string | no | Git 策略. 默認為`fetch` | | `build_timeout` | integer | no | 作業可以運行的最長時間(以分鐘為單位)(以秒為單位) | | `auto_cancel_pending_pipelines` | string | no | 自動取消掛起的管道(注意:這不是布爾值,但已啟用/禁用 | | `build_coverage_regex` | string | no | 測試覆蓋率解析 | | `ci_config_path` | string | no | CI 配置文件的路徑 | | `ci_default_git_depth` | integer | no | [淺克隆的](../ci/pipelines/settings.html#git-shallow-clone)默認修訂版本數 | | `auto_devops_enabled` | boolean | no | 為該項目啟用 Auto DevOps | | `auto_devops_deploy_strategy` | string | no | 自動部署策略( `continuous` , `manual`或`timed_incremental` ) | | `repository_storage` | string | no | 存儲庫位于哪個存儲分片上. 僅適用于管理員 | | `approvals_before_merge` | integer | no | How many approvers should approve merge request by default | | `external_authorization_classification_label` | string | no | 項目的分類標簽 | | `mirror` | boolean | no | 在項目中啟用拉鏡像 | | `mirror_user_id` | integer | no | 用戶負責拉鏡事件周圍的所有活動. 只能由管理員設置. | | `mirror_trigger_builds` | boolean | no | 拉鏡像觸發器構建 | | `only_mirror_protected_branches` | boolean | no | 僅鏡像保護的分支 | | `mirror_overwrites_diverged_branches` | boolean | no | 拉鏡將覆蓋分散的分支 | | `packages_enabled` | boolean | no | 啟用或禁用軟件包存儲庫功能 | | `service_desk_enabled` | boolean | no | 啟用或禁用服務臺功能 | **注意:**如果您的 HTTP 存儲庫不可公開訪問,請將身份驗證信息添加到 URL: `https://username:password@gitlab.company.com/group/project.git` ,其中`password`是啟用了`api`范圍的公共訪問密鑰. ## Fork project[](#fork-project "Permalink") 將項目派生到已認證用戶或提供的用戶的用戶名稱空間中. 項目的分叉操作是異步的,并在后臺作業中完成. 該請求將立即返回. 要確定項目的分支是否已完成,請查詢`import_status`以獲取新項目. ``` POST /projects/:id/fork ``` | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `id` | integer/string | yes | 項目的 ID 或[URL 編碼的路徑](README.html#namespaced-path-encoding) | | `namespace` | integer/string | no | (不建議使用)項目將分叉到的名稱空間的 ID 或路徑 | | `namespace_id` | integer | no | 項目將分叉到的名稱空間的 ID | | `namespace_path` | string | no | 項目將分叉到的名稱空間的路徑 | | `path` | string | no | 分叉后將分配給結果項目的路徑 | | `name` | string | no | 分叉后將分配給結果項目的名稱 | ## List Forks of a project[](#list-forks-of-a-project "Permalink") **注意:**此功能是在 GitLab 10.1 中引入的. 列出呼叫用戶可訪問的與指定項目具有已建立的分叉關系的項目 ``` GET /projects/:id/forks ``` | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `id` | integer/string | yes | 項目的 ID 或[URL 編碼的路徑](README.html#namespaced-path-encoding) | | `archived` | boolean | no | 受存檔狀態限制 | | `visibility` | string | no | 受`public` , `internal`或`private`可見性的限制 | | `order_by` | string | no | 返回按`id` , `name` , `path` , `created_at` , `updated_at`或`last_activity_at`字段排序的項目. 默認為`created_at` | | `sort` | string | no | 返回按`asc`或`desc`順序排序的項目. 默認為`desc` | | `search` | string | no | 返回符合搜索條件的項目列表 | | `simple` | boolean | no | 僅返回每個項目的有限字段. 這是沒有身份驗證的無操作操作,因為這樣*只會*返回簡單的字段. | | `owned` | boolean | no | 受當前用戶明確擁有的項目限制 | | `membership` | boolean | no | 受當前用戶是其成員的項目的限制 | | `starred` | boolean | no | 受當前用戶加注星標的項目限制 | | `statistics` | boolean | no | 包括項目統計 | | `with_custom_attributes` | boolean | no | 在響應中包括[自定義屬性](custom_attributes.html) (僅管理員) | | `with_issues_enabled` | boolean | no | 受啟用的問題限制功能 | | `with_merge_requests_enabled` | boolean | no | 通過啟用的合并請求限制功能 | | `min_access_level` | integer | no | 受當前用戶的最小[訪問權限](members.html)限制 | ``` curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/forks" ``` 響應示例: ``` [ { "id": 3, "description": null, "default_branch": "master", "visibility": "internal", "ssh_url_to_repo": "git@example.com:diaspora/diaspora-project-site.git", "http_url_to_repo": "http://example.com/diaspora/diaspora-project-site.git", "web_url": "http://example.com/diaspora/diaspora-project-site", "readme_url": "http://example.com/diaspora/diaspora-project-site/blob/master/README.md", "tag_list": [ "example", "disapora project" ], "name": "Diaspora Project Site", "name_with_namespace": "Diaspora / Diaspora Project Site", "path": "diaspora-project-site", "path_with_namespace": "diaspora/diaspora-project-site", "issues_enabled": true, "open_issues_count": 1, "merge_requests_enabled": true, "jobs_enabled": true, "wiki_enabled": true, "snippets_enabled": false, "can_create_merge_request_in": true, "resolve_outdated_diff_discussions": false, "container_registry_enabled": false, "created_at": "2013-09-30T13:46:02Z", "last_activity_at": "2013-09-30T13:46:02Z", "creator_id": 3, "namespace": { "id": 3, "name": "Diaspora", "path": "diaspora", "kind": "group", "full_path": "diaspora" }, "import_status": "none", "archived": true, "avatar_url": "http://example.com/uploads/project/avatar/3/uploads/avatar.png", "shared_runners_enabled": true, "forks_count": 0, "star_count": 1, "public_jobs": true, "shared_with_groups": [], "only_allow_merge_if_pipeline_succeeds": false, "allow_merge_on_skipped_pipeline": false, "only_allow_merge_if_all_discussions_are_resolved": false, "remove_source_branch_after_merge": false, "request_access_enabled": false, "merge_method": "merge", "autoclose_referenced_issues": true, "suggestion_commit_message": null, "_links": { "self": "http://example.com/api/v4/projects", "issues": "http://example.com/api/v4/projects/1/issues", "merge_requests": "http://example.com/api/v4/projects/1/merge_requests", "repo_branches": "http://example.com/api/v4/projects/1/repository_branches", "labels": "http://example.com/api/v4/projects/1/labels", "events": "http://example.com/api/v4/projects/1/events", "members": "http://example.com/api/v4/projects/1/members" } } ] ``` ## Star a project[](#star-a-project "Permalink") 明星給定的項目. 如果項目已加星標,則返回狀態碼`304` . ``` POST /projects/:id/star ``` | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `id` | integer/string | yes | 項目的 ID 或[URL 編碼的路徑](README.html#namespaced-path-encoding) | ``` curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/star" ``` 響應示例: ``` { "id": 3, "description": null, "default_branch": "master", "visibility": "internal", "ssh_url_to_repo": "git@example.com:diaspora/diaspora-project-site.git", "http_url_to_repo": "http://example.com/diaspora/diaspora-project-site.git", "web_url": "http://example.com/diaspora/diaspora-project-site", "readme_url": "http://example.com/diaspora/diaspora-project-site/blob/master/README.md", "tag_list": [ "example", "disapora project" ], "name": "Diaspora Project Site", "name_with_namespace": "Diaspora / Diaspora Project Site", "path": "diaspora-project-site", "path_with_namespace": "diaspora/diaspora-project-site", "issues_enabled": true, "open_issues_count": 1, "merge_requests_enabled": true, "jobs_enabled": true, "wiki_enabled": true, "snippets_enabled": false, "can_create_merge_request_in": true, "resolve_outdated_diff_discussions": false, "container_registry_enabled": false, "created_at": "2013-09-30T13:46:02Z", "last_activity_at": "2013-09-30T13:46:02Z", "creator_id": 3, "namespace": { "id": 3, "name": "Diaspora", "path": "diaspora", "kind": "group", "full_path": "diaspora" }, "import_status": "none", "archived": true, "avatar_url": "http://example.com/uploads/project/avatar/3/uploads/avatar.png", "license_url": "http://example.com/diaspora/diaspora-client/blob/master/LICENSE", "license": { "key": "lgpl-3.0", "name": "GNU Lesser General Public License v3.0", "nickname": "GNU LGPLv3", "html_url": "http://choosealicense.com/licenses/lgpl-3.0/", "source_url": "http://www.gnu.org/licenses/lgpl-3.0.txt" }, "shared_runners_enabled": true, "forks_count": 0, "star_count": 1, "public_jobs": true, "shared_with_groups": [], "only_allow_merge_if_pipeline_succeeds": false, "allow_merge_on_skipped_pipeline": false, "only_allow_merge_if_all_discussions_are_resolved": false, "remove_source_branch_after_merge": false, "request_access_enabled": false, "merge_method": "merge", "autoclose_referenced_issues": true, "suggestion_commit_message": null, "_links": { "self": "http://example.com/api/v4/projects", "issues": "http://example.com/api/v4/projects/1/issues", "merge_requests": "http://example.com/api/v4/projects/1/merge_requests", "repo_branches": "http://example.com/api/v4/projects/1/repository_branches", "labels": "http://example.com/api/v4/projects/1/labels", "events": "http://example.com/api/v4/projects/1/events", "members": "http://example.com/api/v4/projects/1/members" } } ``` ## Unstar a project[](#unstar-a-project "Permalink") 取消給定項目的星標. 如果項目未加星標,則返回狀態碼`304` . ``` POST /projects/:id/unstar ``` | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `id` | integer/string | yes | 項目的 ID 或[URL 編碼的路徑](README.html#namespaced-path-encoding) | ``` curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/unstar" ``` 響應示例: ``` { "id": 3, "description": null, "default_branch": "master", "visibility": "internal", "ssh_url_to_repo": "git@example.com:diaspora/diaspora-project-site.git", "http_url_to_repo": "http://example.com/diaspora/diaspora-project-site.git", "web_url": "http://example.com/diaspora/diaspora-project-site", "readme_url": "http://example.com/diaspora/diaspora-project-site/blob/master/README.md", "tag_list": [ "example", "disapora project" ], "name": "Diaspora Project Site", "name_with_namespace": "Diaspora / Diaspora Project Site", "path": "diaspora-project-site", "path_with_namespace": "diaspora/diaspora-project-site", "issues_enabled": true, "open_issues_count": 1, "merge_requests_enabled": true, "jobs_enabled": true, "wiki_enabled": true, "snippets_enabled": false, "can_create_merge_request_in": true, "resolve_outdated_diff_discussions": false, "container_registry_enabled": false, "created_at": "2013-09-30T13:46:02Z", "last_activity_at": "2013-09-30T13:46:02Z", "creator_id": 3, "namespace": { "id": 3, "name": "Diaspora", "path": "diaspora", "kind": "group", "full_path": "diaspora" }, "import_status": "none", "archived": true, "avatar_url": "http://example.com/uploads/project/avatar/3/uploads/avatar.png", "license_url": "http://example.com/diaspora/diaspora-client/blob/master/LICENSE", "license": { "key": "lgpl-3.0", "name": "GNU Lesser General Public License v3.0", "nickname": "GNU LGPLv3", "html_url": "http://choosealicense.com/licenses/lgpl-3.0/", "source_url": "http://www.gnu.org/licenses/lgpl-3.0.txt" }, "shared_runners_enabled": true, "forks_count": 0, "star_count": 0, "public_jobs": true, "shared_with_groups": [], "only_allow_merge_if_pipeline_succeeds": false, "allow_merge_on_skipped_pipeline": false, "only_allow_merge_if_all_discussions_are_resolved": false, "remove_source_branch_after_merge": false, "request_access_enabled": false, "merge_method": "merge", "autoclose_referenced_issues": true, "suggestion_commit_message": null, "_links": { "self": "http://example.com/api/v4/projects", "issues": "http://example.com/api/v4/projects/1/issues", "merge_requests": "http://example.com/api/v4/projects/1/merge_requests", "repo_branches": "http://example.com/api/v4/projects/1/repository_branches", "labels": "http://example.com/api/v4/projects/1/labels", "events": "http://example.com/api/v4/projects/1/events", "members": "http://example.com/api/v4/projects/1/members" } } ``` ## List Starrers of a project[](#list-starrers-of-a-project "Permalink") 列出為指定項目加注星標的用戶. ``` GET /projects/:id/starrers ``` | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `id` | integer/string | yes | 項目的 ID 或[URL 編碼的路徑](README.html#namespaced-path-encoding) | | `search` | string | no | 搜索特定用戶. | ``` curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/starrers" ``` 響應示例: ``` [ { "starred_since": "2019-01-28T14:47:30.642Z", "user": { "id": 1, "username": "jane_smith", "name": "Jane Smith", "state": "active", "avatar_url": "http://localhost:3000/uploads/user/avatar/1/cd8.jpeg", "web_url": "http://localhost:3000/jane_smith" } }, "starred_since": "2018-01-02T11:40:26.570Z", "user": { "id": 2, "username": "janine_smith", "name": "Janine Smith", "state": "blocked", "avatar_url": "http://gravatar.com/../e32131cd8.jpeg", "web_url": "http://localhost:3000/janine_smith" } ] ``` ## Languages[](#languages "Permalink") 獲取具有百分比值的項目中使用的語言. ``` GET /projects/:id/languages ``` | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `id` | integer/string | yes | 項目的 ID 或[URL 編碼的路徑](README.html#namespaced-path-encoding) | ``` curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/languages" ``` 響應示例: ``` { "Ruby": 66.69, "JavaScript": 22.98, "HTML": 7.91, "CoffeeScript": 2.42 } ``` ## Archive a project[](#archive-a-project "Permalink") 如果用戶是該項目的管理員或項目所有者,則歸檔該項目. 此操作是冪等的,因此歸檔已歸檔的項目不會更改該項目. ``` POST /projects/:id/archive ``` | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `id` | integer/string | yes | 項目的 ID 或[URL 編碼的路徑](README.html#namespaced-path-encoding) | ``` curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/archive" ``` 響應示例: ``` { "id": 3, "description": null, "default_branch": "master", "visibility": "private", "ssh_url_to_repo": "git@example.com:diaspora/diaspora-project-site.git", "http_url_to_repo": "http://example.com/diaspora/diaspora-project-site.git", "web_url": "http://example.com/diaspora/diaspora-project-site", "readme_url": "http://example.com/diaspora/diaspora-project-site/blob/master/README.md", "tag_list": [ "example", "disapora project" ], "owner": { "id": 3, "name": "Diaspora", "created_at": "2013-09-30T13:46:02Z" }, "name": "Diaspora Project Site", "name_with_namespace": "Diaspora / Diaspora Project Site", "path": "diaspora-project-site", "path_with_namespace": "diaspora/diaspora-project-site", "issues_enabled": true, "open_issues_count": 1, "merge_requests_enabled": true, "jobs_enabled": true, "wiki_enabled": true, "snippets_enabled": false, "can_create_merge_request_in": true, "resolve_outdated_diff_discussions": false, "container_registry_enabled": false, "created_at": "2013-09-30T13:46:02Z", "last_activity_at": "2013-09-30T13:46:02Z", "creator_id": 3, "namespace": { "id": 3, "name": "Diaspora", "path": "diaspora", "kind": "group", "full_path": "diaspora" }, "import_status": "none", "import_error": null, "permissions": { "project_access": { "access_level": 10, "notification_level": 3 }, "group_access": { "access_level": 50, "notification_level": 3 } }, "archived": true, "avatar_url": "http://example.com/uploads/project/avatar/3/uploads/avatar.png", "license_url": "http://example.com/diaspora/diaspora-client/blob/master/LICENSE", "license": { "key": "lgpl-3.0", "name": "GNU Lesser General Public License v3.0", "nickname": "GNU LGPLv3", "html_url": "http://choosealicense.com/licenses/lgpl-3.0/", "source_url": "http://www.gnu.org/licenses/lgpl-3.0.txt" }, "shared_runners_enabled": true, "forks_count": 0, "star_count": 0, "runners_token": "b8bc4a7a29eb76ea83cf79e4908c2b", "ci_default_git_depth": 50, "public_jobs": true, "shared_with_groups": [], "only_allow_merge_if_pipeline_succeeds": false, "allow_merge_on_skipped_pipeline": false, "only_allow_merge_if_all_discussions_are_resolved": false, "remove_source_branch_after_merge": false, "request_access_enabled": false, "merge_method": "merge", "autoclose_referenced_issues": true, "suggestion_commit_message": null, "_links": { "self": "http://example.com/api/v4/projects", "issues": "http://example.com/api/v4/projects/1/issues", "merge_requests": "http://example.com/api/v4/projects/1/merge_requests", "repo_branches": "http://example.com/api/v4/projects/1/repository_branches", "labels": "http://example.com/api/v4/projects/1/labels", "events": "http://example.com/api/v4/projects/1/events", "members": "http://example.com/api/v4/projects/1/members" } } ``` ## Unarchive a project[](#unarchive-a-project "Permalink") 如果用戶是該項目的管理員或項目所有者,則取消歸檔該項目. 此操作是冪等的,因此取消存檔未存檔的項目不會更改該項目. ``` POST /projects/:id/unarchive ``` | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `id` | integer/string | yes | 項目的 ID 或[URL 編碼的路徑](README.html#namespaced-path-encoding) | ``` curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/unarchive" ``` 響應示例: ``` { "id": 3, "description": null, "default_branch": "master", "visibility": "private", "ssh_url_to_repo": "git@example.com:diaspora/diaspora-project-site.git", "http_url_to_repo": "http://example.com/diaspora/diaspora-project-site.git", "web_url": "http://example.com/diaspora/diaspora-project-site", "readme_url": "http://example.com/diaspora/diaspora-project-site/blob/master/README.md", "tag_list": [ "example", "disapora project" ], "owner": { "id": 3, "name": "Diaspora", "created_at": "2013-09-30T13:46:02Z" }, "name": "Diaspora Project Site", "name_with_namespace": "Diaspora / Diaspora Project Site", "path": "diaspora-project-site", "path_with_namespace": "diaspora/diaspora-project-site", "issues_enabled": true, "open_issues_count": 1, "merge_requests_enabled": true, "jobs_enabled": true, "wiki_enabled": true, "snippets_enabled": false, "can_create_merge_request_in": true, "resolve_outdated_diff_discussions": false, "container_registry_enabled": false, "created_at": "2013-09-30T13:46:02Z", "last_activity_at": "2013-09-30T13:46:02Z", "creator_id": 3, "namespace": { "id": 3, "name": "Diaspora", "path": "diaspora", "kind": "group", "full_path": "diaspora" }, "import_status": "none", "import_error": null, "permissions": { "project_access": { "access_level": 10, "notification_level": 3 }, "group_access": { "access_level": 50, "notification_level": 3 } }, "archived": false, "avatar_url": "http://example.com/uploads/project/avatar/3/uploads/avatar.png", "license_url": "http://example.com/diaspora/diaspora-client/blob/master/LICENSE", "license": { "key": "lgpl-3.0", "name": "GNU Lesser General Public License v3.0", "nickname": "GNU LGPLv3", "html_url": "http://choosealicense.com/licenses/lgpl-3.0/", "source_url": "http://www.gnu.org/licenses/lgpl-3.0.txt" }, "shared_runners_enabled": true, "forks_count": 0, "star_count": 0, "runners_token": "b8bc4a7a29eb76ea83cf79e4908c2b", "ci_default_git_depth": 50, "public_jobs": true, "shared_with_groups": [], "only_allow_merge_if_pipeline_succeeds": false, "allow_merge_on_skipped_pipeline": false, "only_allow_merge_if_all_discussions_are_resolved": false, "remove_source_branch_after_merge": false, "request_access_enabled": false, "merge_method": "merge", "autoclose_referenced_issues": true, "suggestion_commit_message": null, "_links": { "self": "http://example.com/api/v4/projects", "issues": "http://example.com/api/v4/projects/1/issues", "merge_requests": "http://example.com/api/v4/projects/1/merge_requests", "repo_branches": "http://example.com/api/v4/projects/1/repository_branches", "labels": "http://example.com/api/v4/projects/1/labels", "events": "http://example.com/api/v4/projects/1/events", "members": "http://example.com/api/v4/projects/1/members" } } ``` ## Remove project[](#remove-project "Permalink") 該端點: * 刪除包含所有相關資源(問題,合并請求等)的項目. * 從[Premium 或 Silver](https://about.gitlab.com/pricing/)或更高級別的[GitLab 12.6](https://gitlab.com/gitlab-org/gitlab/-/issues/32935)開始,將項目標記為刪除. 實際刪除發生在[實例設置中](../user/admin_area/settings/visibility_and_access_controls.html#default-deletion-adjourned-period-premium-only)指定的天數之后. ``` DELETE /projects/:id ``` | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `id` | integer/string | yes | 項目的 ID 或[URL 編碼的路徑](README.html#namespaced-path-encoding) | ## Restore project marked for deletion[](#restore-project-marked-for-deletion-premium "Permalink") 在 GitLab 12.6 中[引入](https://gitlab.com/gitlab-org/gitlab/-/issues/32935) . 恢復標記為刪除的項目. ``` POST /projects/:id/restore ``` | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `id` | integer/string | yes | 項目的 ID 或[URL 編碼的路徑](README.html#namespaced-path-encoding) | ## Upload a file[](#upload-a-file "Permalink") 將文件上載到指定的項目,以在發布或合并請求描述或注釋中使用. ``` POST /projects/:id/uploads ``` | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `id` | integer/string | yes | 項目的 ID 或[URL 編碼的路徑](README.html#namespaced-path-encoding) | | `file` | string | yes | 要上傳的文件 | 要從文件系統上載文件,請使用`--form`參數. 這將導致 cURL 使用標題`Content-Type: multipart/form-data` . `file=`參數必須指向文件系統上的文件,并以`@`開頭. 例如: ``` curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" --form "file=@dk.png" "https://gitlab.example.com/api/v4/projects/5/uploads" ``` Returned object: ``` { "alt": "dk", "url": "/uploads/66dbcd21ec5d24ed6ea225176098d52b/dk.png", "full_path": "/namespace1/project1/uploads/66dbcd21ec5d24ed6ea225176098d52b/dk.png", "markdown": "![dk](/uploads/66dbcd21ec5d24ed6ea225176098d52b/dk.png)" } ``` > **注意** :返回的`url`是相對于項目路徑的. 返回的`full_path`是文件的絕對路徑. 在 Markdown 上下文中,當使用`markdown`的格式時,鏈接會自動展開. ## Share project with group[](#share-project-with-group "Permalink") 允許與小組共享項目. ``` POST /projects/:id/share ``` | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `id` | integer/string | yes | 項目的 ID 或[URL 編碼的路徑](README.html#namespaced-path-encoding) | | `group_id` | integer | yes | 與之共享的組的 ID | | `group_access` | integer | yes | 授予組的[權限級別](members.html) | | `expires_at` | string | no | ISO 8601 格式的股份到期日:2016-09-26 | ## Delete a shared project link within a group[](#delete-a-shared-project-link-within-a-group "Permalink") 從小組取消共享項目. 返回`204` ,成功則不返回任何內容. ``` DELETE /projects/:id/share/:group_id ``` | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `id` | integer/string | yes | 項目的 ID 或[URL 編碼的路徑](README.html#namespaced-path-encoding) | | `group_id` | integer | yes | 組的 ID | ``` curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/share/17" ``` ## Hooks[](#hooks "Permalink") 也稱為 Project Hooks 和 Webhooks. 對于系統范圍的[系統掛鉤](system_hooks.html) ,這些是不同的. ### List project hooks[](#list-project-hooks "Permalink") 獲取項目掛鉤的列表. ``` GET /projects/:id/hooks ``` | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `id` | integer/string | yes | 項目的 ID 或[URL 編碼的路徑](README.html#namespaced-path-encoding) | ### Get project hook[](#get-project-hook "Permalink") 獲取項目的特定掛鉤. ``` GET /projects/:id/hooks/:hook_id ``` | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `id` | integer/string | yes | 項目的 ID 或[URL 編碼的路徑](README.html#namespaced-path-encoding) | | `hook_id` | integer | yes | 項目掛鉤的 ID | ``` { "id": 1, "url": "http://example.com/hook", "project_id": 3, "push_events": true, "push_events_branch_filter": "", "issues_events": true, "confidential_issues_events": true, "merge_requests_events": true, "tag_push_events": true, "note_events": true, "confidential_note_events": true, "job_events": true, "pipeline_events": true, "wiki_page_events": true, "enable_ssl_verification": true, "created_at": "2012-10-12T17:04:47Z" } ``` ### Add project hook[](#add-project-hook "Permalink") 將鉤子添加到指定項目. ``` POST /projects/:id/hooks ``` | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `id` | integer/string | yes | 項目的 ID 或[URL 編碼的路徑](README.html#namespaced-path-encoding) | | `url` | string | yes | 掛鉤網址 | | `push_events` | boolean | no | 在推送事件上觸發鉤子 | | `push_events_branch_filter` | string | no | 觸發推送事件上的鉤子,僅用于匹配分支 | | `issues_events` | boolean | no | 觸發問題事件掛鉤 | | `confidential_issues_events` | boolean | no | 觸發機密問題事件的鉤子 | | `merge_requests_events` | boolean | no | 觸發合并請求事件的鉤子 | | `tag_push_events` | boolean | no | 觸發標簽推送事件的鉤子 | | `note_events` | boolean | no | 在音符事件上觸發鉤子 | | `confidential_note_events` | boolean | no | 觸發機密筆記事件的鉤子 | | `job_events` | boolean | no | 觸發工作事件掛鉤 | | `pipeline_events` | boolean | no | 觸發管道事件鉤子 | | `wiki_page_events` | boolean | no | 觸發 Wiki 事件的鉤子 | | `enable_ssl_verification` | boolean | no | 觸發掛鉤時執行 SSL 驗證 | | `token` | string | no | 用于驗證收到的有效載荷的秘密令牌; 這將不會在響應中返回 | ### Edit project hook[](#edit-project-hook "Permalink") Edits a hook for a specified project. ``` PUT /projects/:id/hooks/:hook_id ``` | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `id` | integer/string | yes | 項目的 ID 或[URL 編碼的路徑](README.html#namespaced-path-encoding) | | `hook_id` | integer | yes | 項目掛鉤的 ID | | `url` | string | yes | 掛鉤網址 | | `push_events` | boolean | no | 在推送事件上觸發鉤子 | | `push_events_branch_filter` | string | no | 觸發推送事件上的鉤子,僅用于匹配分支 | | `issues_events` | boolean | no | Trigger hook on issues events | | `confidential_issues_events` | boolean | no | 觸發機密問題事件的鉤子 | | `merge_requests_events` | boolean | no | 觸發合并請求事件的鉤子 | | `tag_push_events` | boolean | no | 觸發標簽推送事件的鉤子 | | `note_events` | boolean | no | 在音符事件上觸發鉤子 | | `confidential_note_events` | boolean | no | 觸發機密筆記事件的鉤子 | | `job_events` | boolean | no | 觸發工作事件掛鉤 | | `pipeline_events` | boolean | no | 觸發管道事件鉤子 | | `wiki_events` | boolean | no | 觸發 Wiki 事件的鉤子 | | `enable_ssl_verification` | boolean | no | 觸發掛鉤時執行 SSL 驗證 | | `token` | string | no | 用于驗證收到的有效載荷的秘密令牌; 這將不會在響應中返回 | ### Delete project hook[](#delete-project-hook "Permalink") 從項目中刪除一個鉤子. 這是冪等方法,可以多次調用. 掛鉤是否可用. ``` DELETE /projects/:id/hooks/:hook_id ``` | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `id` | integer/string | yes | 項目的 ID 或[URL 編碼的路徑](README.html#namespaced-path-encoding) | | `hook_id` | integer | yes | 項目掛鉤的 ID | 請注意,無論掛鉤是否可用,JSON 響應都會有所不同. 如果項目掛鉤在 JSON 響應中返回之前可用,或者返回空響應. ## Fork relationship[](#fork-relationship "Permalink") 允許修改現有項目之間的分支關系. 僅適用于項目所有者和管理員. ### Create a forked from/to relation between existing projects[](#create-a-forked-fromto-relation-between-existing-projects "Permalink") ``` POST /projects/:id/fork/:forked_from_id ``` | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `id` | integer/string | yes | 項目的 ID 或[URL 編碼的路徑](README.html#namespaced-path-encoding) | | `forked_from_id` | ID | yes | 分叉的項目的 ID | ### Delete an existing forked from relationship[](#delete-an-existing-forked-from-relationship "Permalink") ``` DELETE /projects/:id/fork ``` | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `id` | integer/string | yes | 項目的 ID 或[URL 編碼的路徑](README.html#namespaced-path-encoding) | ## Search for projects by name[](#search-for-projects-by-name "Permalink") 通過名稱搜索可通過身份驗證的用戶訪問的項目. 如果可以公開訪問該項目,則無需身份驗證即可訪問該端點. ``` GET /projects ``` | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `search` | string | yes | 項目名稱中包含的字符串 | | `order_by` | string | no | 返回按`id` , `name` , `created_at`或`last_activity_at`字段排序的請求 | | `sort` | string | no | 返回請求按`asc`或`desc`排序 | ``` curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects?search=test" ``` ## Start the Housekeeping task for a Project[](#start-the-housekeeping-task-for-a-project "Permalink") 在 GitLab 9.0 中引入. ``` POST /projects/:id/housekeeping ``` | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `id` | integer/string | yes | 項目或 NAMESPACE / PROJECT_NAME 的 ID | ## Push Rules[](#push-rules-starter "Permalink") ### Get project push rules[](#get-project-push-rules "Permalink") 獲取項目的推送規則. ``` GET /projects/:id/push_rule ``` | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `id` | integer/string | yes | 項目或 NAMESPACE / PROJECT_NAME 的 ID | ``` { "id": 1, "project_id": 3, "commit_message_regex": "Fixes \d+\..*", "commit_message_negative_regex": "ssh\:\/\/", "branch_name_regex": "", "deny_delete_tag": false, "created_at": "2012-10-12T17:04:47Z", "member_check": false, "prevent_secrets": false, "author_email_regex": "", "file_name_regex": "", "max_file_size": 5, "commit_committer_check": false, "reject_unsigned_commits": false } ``` 使用 GitLab [Premium,Silver 或更高版本的用戶](https://about.gitlab.com/pricing/)還將看到`commit_committer_check`和`reject_unsigned_commits`參數: ``` { "id": 1, "project_id": 3, "commit_committer_check": false, "reject_unsigned_commits": false ... } ``` ### Add project push rule[](#add-project-push-rule "Permalink") 將推送規則添加到指定項目. ``` POST /projects/:id/push_rule ``` | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `id` | integer/string | yes | 項目或 NAMESPACE / PROJECT_NAME 的 ID | | `deny_delete_tag` | boolean | no | 拒絕刪除標簽 | | `member_check` | boolean | no | 限制作者(電子郵件)對現有 GitLab 用戶的提交 | | `prevent_secrets` | boolean | no | GitLab 將拒絕任何可能包含機密的文件 | | `commit_message_regex` | string | no | 所有提交消息都必須與此匹配,例如`Fixed \d+\..*` | | `commit_message_negative_regex` | string | no | 不允許任何提交消息與此匹配,例如`ssh\:\/\/` | | `branch_name_regex` | string | no | 所有分支名稱必須與此匹配,例如`(feature&#124;hotfix)\/*` | | `author_email_regex` | string | no | 所有提交作者的電子郵件都必須與此匹配,例如`@my-company.com$` | | `file_name_regex` | string | no | 所有提交的文件名都**不能**與此匹配,例如`(jar&#124;exe)$` | | `max_file_size` | integer | no | 檔案大小上限(MB) | | `commit_committer_check` | boolean | no | 用戶只能將使用自己的已驗證電子郵件之一提交的提交推送到該存儲庫. | | `reject_unsigned_commits` | boolean | no | 如果未通過 GPG 簽名,則拒絕提交. | ### Edit project push rule[](#edit-project-push-rule "Permalink") 編輯指定項目的推送規則. ``` PUT /projects/:id/push_rule ``` | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `id` | integer/string | yes | 項目或 NAMESPACE / PROJECT_NAME 的 ID | | `deny_delete_tag` | boolean | no | 拒絕刪除標簽 | | `member_check` | boolean | no | 限制作者(電子郵件)對現有 GitLab 用戶的提交 | | `prevent_secrets` | boolean | no | GitLab will reject any files that are likely to contain secrets | | `commit_message_regex` | string | no | 所有提交消息都必須與此匹配,例如`Fixed \d+\..*` | | `commit_message_negative_regex` | string | no | 不允許任何提交消息與此匹配,例如`ssh\:\/\/` | | `branch_name_regex` | string | no | 所有分支名稱必須與此匹配,例如`(feature&#124;hotfix)\/*` | | `author_email_regex` | string | no | 所有提交作者的電子郵件都必須與此匹配,例如`@my-company.com$` | | `file_name_regex` | string | no | 所有提交的文件名都**不能**與此匹配,例如`(jar&#124;exe)$` | | `max_file_size` | integer | no | 檔案大小上限(MB) | | `commit_committer_check` | boolean | no | 用戶只能將使用自己的已驗證電子郵件之一提交的提交推送到該存儲庫. | | `reject_unsigned_commits` | boolean | no | 沒有 GPG 簽名時拒絕提交. | ### Delete project push rule[](#delete-project-push-rule "Permalink") 在[GitLab Starter](https://about.gitlab.com/pricing/) 9.0 中引入. 從項目中刪除推送規則. 這是冪等方法,可以多次調用. 推送規則是否可用. ``` DELETE /projects/:id/push_rule ``` | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `id` | integer/string | yes | 項目的 ID 或[URL 編碼的路徑](README.html#namespaced-path-encoding) | ## Transfer a project to a new namespace[](#transfer-a-project-to-a-new-namespace "Permalink") 在 GitLab 11.1 中引入. ``` PUT /projects/:id/transfer ``` | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `id` | integer/string | yes | 項目的 ID 或[URL 編碼的路徑](README.html#namespaced-path-encoding) | | `namespace` | integer/string | yes | 要轉移到項目的名稱空間的 ID 或路徑 | ## Branches[](#branches "Permalink") 在" [分支機構"](branches.html)文檔中了解更多信息. ## Project Import/Export[](#project-importexport "Permalink") 在[項目導入/導出](project_import_export.html)文檔中了解更多信息. ## Project members[](#project-members "Permalink") 在[項目成員](members.html)文檔中了解更多信息. ## Start the pull mirroring process for a Project[](#start-the-pull-mirroring-process-for-a-project-starter "Permalink") 在[GitLab Starter](https://about.gitlab.com/pricing/) 10.3 中引入. ``` POST /projects/:id/mirror/pull ``` | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `id` | integer/string | yes | 項目的 ID 或[URL 編碼的路徑](README.html#namespaced-path-encoding) | ``` curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/:id/mirror/pull" ``` ## Project badges[](#project-badges "Permalink") 在[Project Badges](project_badges.html)文檔中了解更多信息. ## Issue and merge request description templates[](#issue-and-merge-request-description-templates "Permalink") 非默認的[問題和合并請求描述模板](../user/project/description_templates.html)在項目的存儲庫中進行管理. 因此,您可以通過[Repositories API](repositories.html)和[Repository Files API](repository_files.html)通過 API 管理它們. ## Download snapshot of a Git repository[](#download-snapshot-of-a-git-repository "Permalink") 在 GitLab 10.7 中引入 該端點只能由管理用戶訪問. 下載項目(或 Wiki,如果需要)Git 存儲庫的快照. 該快照始終為未壓縮的[tar](https://en.wikipedia.org/wiki/Tar_(computing))格式. 如果存儲庫損壞到`git clone`不起作用的程度,則快照可能允許檢索某些數據. ``` GET /projects/:id/snapshot ``` | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `id` | integer/string | yes | 項目的 ID 或[URL 編碼的路徑](README.html#namespaced-path-encoding) | | `wiki` | boolean | no | 是否下載 Wiki,而不是項目存儲庫 |
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看