团队协作 #
团队概述 #
Vercel 团队功能支持多人协作开发:
text
┌─────────────────────────────────────────┐
│ Vercel 团队结构 │
├─────────────────────────────────────────┤
│ Team │
│ ├── Owner (所有者) │
│ ├── Members (成员) │
│ │ ├── Developer │
│ │ └── Viewer │
│ └── Projects (项目) │
│ ├── Project A │
│ └── Project B │
└─────────────────────────────────────────┘
创建团队 #
通过 Dashboard #
text
Dashboard → Add Team
text
┌─────────────────────────────────────────┐
│ Create a Team │
├─────────────────────────────────────────┤
│ Team Name: [My Team ] │
│ Slug: [my-team ] │
│ │
│ Plan: │
│ ○ Hobby (Free) │
│ ● Pro ($20/member/month) │
│ │
│ [Create Team] │
└─────────────────────────────────────────┘
通过 CLI #
bash
vercel teams create my-team
团队角色与权限 #
角色类型 #
| 角色 | 权限 |
|---|---|
| Owner | 完全控制,包括计费和删除团队 |
| Member | 部署项目、管理设置 |
| Developer | 部署项目、查看日志 |
| Viewer | 只读访问 |
| Billing | 管理计费信息 |
权限对比 #
| 操作 | Owner | Member | Developer | Viewer | Billing |
|---|---|---|---|---|---|
| 删除团队 | ✅ | ❌ | ❌ | ❌ | ❌ |
| 管理计费 | ✅ | ❌ | ❌ | ❌ | ✅ |
| 邀请成员 | ✅ | ✅ | ❌ | ❌ | ❌ |
| 移除成员 | ✅ | ✅ | ❌ | ❌ | ❌ |
| 创建项目 | ✅ | ✅ | ✅ | ❌ | ❌ |
| 部署项目 | ✅ | ✅ | ✅ | ❌ | ❌ |
| 查看项目 | ✅ | ✅ | ✅ | ✅ | ❌ |
| 管理域名 | ✅ | ✅ | ❌ | ❌ | ❌ |
| 管理环境变量 | ✅ | ✅ | ❌ | ❌ | ❌ |
成员管理 #
邀请成员 #
text
Team Settings → Members → Invite
text
┌─────────────────────────────────────────┐
│ Invite Team Members │
├─────────────────────────────────────────┤
│ Email: [teammate@example.com] │
│ Role: [Member ▼] │
│ │
│ [Send Invitation] │
└─────────────────────────────────────────┘
通过 CLI 邀请 #
bash
vercel teams invite teammate@example.com
批量邀请 #
bash
vercel teams invite user1@example.com user2@example.com
移除成员 #
text
Team Settings → Members → [Remove]
修改角色 #
text
Team Settings → Members → [Change Role]
项目权限 #
项目级别权限 #
text
Project Settings → Access
text
┌─────────────────────────────────────────┐
│ Project Access │
├─────────────────────────────────────────┤
│ Team Access: │
│ ● Everyone (Team Members) │
│ ○ Selected Members │
│ │
│ Selected Members: │
│ ├── alice@example.com (Admin) │
│ ├── bob@example.com (Edit) │
│ └── carol@example.com (View) │
└─────────────────────────────────────────┘
项目角色 #
| 角色 | 权限 |
|---|---|
| Admin | 完全项目管理权限 |
| Edit | 部署、环境变量、域名 |
| View | 只读访问 |
团队设置 #
团队信息 #
text
Team Settings → General
├── Team Name
├── Team Slug
├── Team Image
└── Description
团队域名 #
text
Team Settings → Domains
text
┌─────────────────────────────────────────┐
│ Team Domain │
├─────────────────────────────────────────┤
│ Default: my-team.vercel.app │
│ │
│ Custom Domains: │
│ ├── team.example.com │
│ └── *.team.example.com │
└─────────────────────────────────────────┘
SSO 配置 #
text
Team Settings → Security → SAML SSO
text
┌─────────────────────────────────────────┐
│ SAML Single Sign-On │
├─────────────────────────────────────────┤
│ Identity Provider: │
│ ├── Okta │
│ ├── Azure AD │
│ ├── Google Workspace │
│ └── Custom │
│ │
│ Configuration: │
│ ├── Entity ID: vercel.com/saml/xxx │
│ ├── ACS URL: https://vercel.com/saml │
│ └── Certificate: [Upload] │
└─────────────────────────────────────────┘
协作流程 #
Git 工作流集成 #
text
┌──────────────────────────────────────────────────────┐
│ │
│ 开发者创建分支 │
│ │ │
│ ▼ │
│ 推送到 Git 仓库 │
│ │ │
│ ▼ │
│ Vercel 自动创建预览部署 │
│ │ │
│ ▼ │
│ 团队成员审查预览 │
│ │ │
│ ▼ │
│ 合并到主分支 │
│ │ │
│ ▼ │
│ 自动部署到生产环境 │
│ │
└──────────────────────────────────────────────────────┘
PR 审查流程 #
text
1. 开发者创建 PR
├── 自动生成预览链接
└── Vercel 评论 PR
2. 团队成员审查
├── 查看预览效果
├── 测试功能
└── 添加评论反馈
3. 审查通过
├── Approve PR
└── 合并分支
4. 自动部署
└── 生产环境更新
评论与反馈 #
text
┌─────────────────────────────────────────┐
│ 💬 Deployment Comment │
├─────────────────────────────────────────┤
│ @alice: LGTM! Looks good to merge. │
│ │
│ @bob: Found a bug on mobile view. │
│ Please check the responsive layout. │
│ │
│ @carol: Performance looks great! │
│ LCP: 1.2s │
└─────────────────────────────────────────┘
团队环境变量 #
团队级别变量 #
text
Team Settings → Environment Variables
text
┌─────────────────────────────────────────┐
│ Team Environment Variables │
├─────────────────────────────────────────┤
│ TEAM_API_KEY = xxx │
│ SHARED_SECRET = xxx │
│ │
│ [Add Variable] │
└─────────────────────────────────────────┘
变量优先级 #
text
项目环境变量 > 团队环境变量 > 系统环境变量
团队计费 #
查看账单 #
text
Team Settings → Billing
├── Current Plan
├── Usage
├── Payment Methods
└── Invoices
用量统计 #
text
┌─────────────────────────────────────────┐
│ Team Usage │
├─────────────────────────────────────────┤
│ Bandwidth: 50GB / 1TB │
│ Build Minutes: 1200 / Unlimited │
│ Functions: 200GB-Hrs / 1000GB-Hrs │
│ Members: 5 / Unlimited │
└─────────────────────────────────────────┘
升级计划 #
text
Team Settings → Billing → Change Plan
团队安全 #
双因素认证 #
text
Team Settings → Security → Two-Factor Authentication
text
┌─────────────────────────────────────────┐
│ Two-Factor Authentication │
├─────────────────────────────────────────┤
│ Require 2FA for all team members │
│ │
│ ☑ Enforce 2FA │
│ │
│ [Save] │
└─────────────────────────────────────────┘
IP 白名单 #
text
Team Settings → Security → IP Allowlist
text
┌─────────────────────────────────────────┐
│ IP Allowlist │
├─────────────────────────────────────────┤
│ IP Address: [192.168.1.0/24 ] │
│ [Add IP] │
│ │
│ Allowed IPs: │
│ ├── 192.168.1.0/24 │
│ └── 10.0.0.1 │
└─────────────────────────────────────────┘
团队 API #
获取团队信息 #
bash
curl "https://api.vercel.com/v2/teams" \
-H "Authorization: Bearer $VERCEL_TOKEN"
邀请成员 #
bash
curl -X POST "https://api.vercel.com/v1/teams/$TEAM_ID/members" \
-H "Authorization: Bearer $VERCEL_TOKEN" \
-H "Content-Type: application/json" \
-d '{"email": "user@example.com", "role": "MEMBER"}'
列出成员 #
bash
curl "https://api.vercel.com/v2/teams/$TEAM_ID/members" \
-H "Authorization: Bearer $VERCEL_TOKEN"
最佳实践 #
团队管理建议 #
text
┌─────────────────────────────────────────┐
│ 团队协作最佳实践 │
├─────────────────────────────────────────┤
│ ✓ 明确角色分工 │
│ ✓ 使用 SSO 统一认证 │
│ ✓ 启用双因素认证 │
│ ✓ 定期审查成员权限 │
│ ✓ 使用团队环境变量共享配置 │
│ ✓ 建立 PR 审查流程 │
│ ✓ 监控团队用量 │
└─────────────────────────────────────────┘
安全建议 #
text
1. 启用 SSO
2. 强制双因素认证
3. 定期审查访问权限
4. 使用 IP 白名单
5. 监控异常活动
下一步 #
了解团队协作后,接下来学习 监控与分析 掌握项目监控能力!
最后更新:2026-03-28