VSTS与企业自有Git集成可行性及操作选项咨询
Absolutely feasible! Let me break this down clearly to help you make the right choice:
VSTS (now commonly referred to as Azure DevOps Services) fully supports integrating with external self-hosted Git repositories. You don’t need to migrate your code to VSTS Git at all—you can keep your code in your own Git server while using VSTS for task/project management, integration, and monitoring seamlessly.
Let’s walk through the two options you mentioned and which fits your needs perfectly:
1. 导入仓库
- What it does: This creates a full copy of your external Git repository in VSTS Git. It’s essentially a migration (you can set up syncs later, but you’ll end up maintaining two copies of your codebase).
- Why it’s not for you: Your core requirement is to avoid migrating code to VSTS Git, so importing would directly contradict that goal. This option only makes sense if you want to fully move your codebase to VSTS long-term.
2. 从外部仓库构建代码 (External Repository Integration)
- This is exactly the solution you need! VSTS lets you directly connect to your self-hosted Git repository without moving any code. Here’s what you can achieve with this setup:
- Link VSTS work items to commits/PRs in your external Git: Just add
#work-item-IDin your commit messages, and VSTS will automatically associate the code change with the corresponding task—making it easy to track how tasks map to code updates. - Set up CI/CD pipelines directly from your external repo: Pull code from your own Git server to run builds, tests, and deployments, all within VSTS. No code needs to reside in VSTS Git at any point.
- Monitor repository quality: Use VSTS’s branch policies (e.g., require PRs to link to work items, pass tests before merging) and custom dashboards to keep an eye on code health and change activity.
- Access repo stats: View commit history, contributor activity, and other key metrics right in VSTS without leaving the platform.
- Link VSTS work items to commits/PRs in your external Git: Just add
- How to set it up: In your VSTS project, head to either the
PipelinesorReposmodule, select "Connect repository", choose your external Git provider type, enter your repo URL and authentication details (like SSH keys or credentials), and complete the connection.
Go with "从外部仓库构建代码" (or more accurately, external repository integration)—it perfectly aligns with your goal of keeping code in your own Git repo while leveraging VSTS for all your project management, integration, and monitoring needs.
内容的提问来源于stack exchange,提问作者Adityo Setyonugroho

