mirror of
https://gitea.com/gitea/docs.git
synced 2026-09-20 04:58:52 +00:00
docs: update zh-tw (#265)
Reviewed-on: https://gitea.com/gitea/docs/pulls/265 Reviewed-by: Lunny Xiao <[email protected]> Co-authored-by: ifurther <[email protected]> Co-committed-by: ifurther <[email protected]>
This commit is contained in:
@@ -4,25 +4,25 @@ slug: "go"
|
||||
sidebar_position: 45
|
||||
---
|
||||
|
||||
# Go 软件包注册表
|
||||
# Go 軟體包註冊表
|
||||
|
||||
为您的用户或组织发布 Go 软件包。
|
||||
為您的使用者或組織發佈 Go 軟體包。
|
||||
|
||||
## 发布软件包
|
||||
## 發佈軟體包
|
||||
|
||||
要发布 Go 软件包,请执行 HTTP `PUT` 操作,并将软件包内容放入请求主体中。
|
||||
如果已经存在相同名称和版本的软件包,您无法发布软件包。您必须首先删除现有的软件包。
|
||||
该软件包必须遵循[文档中的结构](https://go.dev/ref/mod#zip-files)。
|
||||
要發佈 Go 軟體包,請執行 HTTP `PUT` 操作,並将軟體包内容放入請求主體中。
|
||||
如果已经存在相同名稱和版本的軟體包,您無法發佈軟體包。您必須首先删除現有的軟體包。
|
||||
該軟體包必須遵循[文檔中的结构](https://go.dev/ref/mod#zip-files)。
|
||||
|
||||
```
|
||||
PUT https://gitea.example.com/api/packages/{owner}/go/upload
|
||||
```
|
||||
|
||||
| 参数 | 描述 |
|
||||
| 參數 | 描述 |
|
||||
| ------- | -------------- |
|
||||
| `owner` | 软件包的所有者 |
|
||||
| `owner` | 軟體包的所有者 |
|
||||
|
||||
要身份验证到软件包注册表,您需要提供[自定义 HTTP 头或使用 HTTP 基本身份验证](development/api-usage.md#通过-api-认证):
|
||||
要身份驗證到軟體包註冊表,您需要提供[自定义 HTTP 头或使用 HTTP 基本身份驗證](development/api-usage.md#通過-api-認證):
|
||||
|
||||
```shell
|
||||
curl --user your_username:your_password_or_token \
|
||||
@@ -30,19 +30,19 @@ curl --user your_username:your_password_or_token \
|
||||
https://gitea.example.com/api/packages/testuser/go/upload
|
||||
```
|
||||
|
||||
如果您使用的是 2FA 或 OAuth,请使用[个人访问令牌](development/api-usage.md#通过-api-认证)替代密码进行身份验证。
|
||||
如果您使用的是 2FA 或 OAuth,請使用[个人访问令牌](development/api-usage.md#通過-api-認證)替代密碼進行身份驗證。
|
||||
|
||||
服务器将使用以下 HTTP 状态代码进行响应。
|
||||
服务器将使用以下 HTTP 状态代码進行響應。
|
||||
|
||||
| HTTP 状态码 | 含义 |
|
||||
| ----------------- | -------------------------- |
|
||||
| `201 Created` | 软件包已发布 |
|
||||
| `400 Bad Request` | 软件包无效 |
|
||||
| `409 Conflict` | 具有相同名称的软件包已存在 |
|
||||
| `201 Created` | 軟體包已發佈 |
|
||||
| `400 Bad Request` | 軟體包無效 |
|
||||
| `409 Conflict` | 具有相同名稱的軟體包已存在 |
|
||||
|
||||
## 安装软件包
|
||||
## 安裝軟體包
|
||||
|
||||
要安装Go软件包,请指示Go使用软件包注册表作为代理:
|
||||
要安裝Go軟體包,請指示Go使用軟體包註冊表作為代理:
|
||||
|
||||
```shell
|
||||
# 使用最新版本
|
||||
@@ -53,12 +53,12 @@ GOPROXY=https://gitea.example.com/api/packages/{owner}/go go install {package_na
|
||||
GOPROXY=https://gitea.example.com/api/packages/{owner}/go go install {package_name}@{package_version}
|
||||
```
|
||||
|
||||
| 参数 | 描述 |
|
||||
| 參數 | 描述 |
|
||||
| ----------------- | -------------- |
|
||||
| `owner` | 软件包的所有者 |
|
||||
| `package_name` | 软件包名称 |
|
||||
| `package_version` | 软件包版本 |
|
||||
| `owner` | 軟體包的所有者 |
|
||||
| `package_name` | 軟體包名稱 |
|
||||
| `package_version` | 軟體包版本 |
|
||||
|
||||
如果软件包的所有者是私有的,则需要[提供凭据](https://go.dev/ref/mod#private-module-proxy-auth)。
|
||||
如果軟體包的所有者是私有的,则需要[提供凭据](https://go.dev/ref/mod#private-module-proxy-auth)。
|
||||
|
||||
有关 `GOPROXY` 环境变量的更多信息以及如何防止数据泄漏的信息,请[参阅文档](https://go.dev/ref/mod#private-modules)。
|
||||
有关 `GOPROXY` 环境变量的更多信息以及如何防止数据泄漏的信息,請[参阅文檔](https://go.dev/ref/mod#private-modules)。
|
||||
|
||||
Reference in New Issue
Block a user