azure - 如何将项目代码从本地计算机导入到Azure Repos?

标签 azure visual-studio-2017 repository azure-devops

我在 Visual Studio 的本地 PC 上有现有代码,我想将其导入到 Azure Repos 项目。我已经在 Azure DevOps 中创建了该项目。我在 VS 2017 中使用 Team Explorer 连接到我的 DevOps 项目。我不知道如何进行初始导入。

最佳答案

如果您在 Azure Devops 中使用 Git 存储库,请引用以下命令将项目导入到 Azure Git 存储库:

#In the local directory for the root of the project 
git init 
git remote add origin <URL for Azure Git repo> 
git add .
git status   
git commit -m "initial commit"  
git push -u origin master 

然后本地计算机中的项目将在 Azure Git 存储库中进行管理。

注意:如果本地项目已经在本地 git 存储库中进行管理,那么您可以跳过 git init 命令。

如果您在 Azure Devops 中使用 TFVC 存储库,请引用以下步骤将本地项目导入到 Azure TFVC 存储库:

  1. 将 TFVC 与 VS 连接

在 VS 中 -> 团队资源管理器 -> 管理连接 -> 添加帐户 -> 输入用于登录 Azure Devops 的电子邮件地址和密码 -> 选择 TFVC 存储库 -> 连接。

enter image description here enter image description here

  • 将 TFVC 存储库映射到本地目录。
  • 单击映射和获取按钮映射 TFVC 存储库并下载指定目录中的文件(如以下示例中的 C:\Users\Administrator\Source\Workspaces\Git2)。

    enter image description here

  • 将本地项目复制到映射目录并 checkin 更改
  • 在 TFVC 存储库映射目录中复制您的项目 -> 团队资源管理器 -> 源代码管理资源管理器 -> 单击将项目添加到文件夹图标 -> 选择您在映射目录中复制的所有项目文件 -> 完成 -> 团队资源管理器 -> 待定更改 -> checkin 更改。

    enter image description here

    因此本地项目将被导入到 Azure Devops 中的 TFVC 存储库中。

    关于azure - 如何将项目代码从本地计算机导入到Azure Repos?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52334570/

    相关文章:

    visual-studio - 错误MSB3644 : The reference assemblies for framework ".NETFramework,Version=v4.5" were not found

    c++ - 无法在 VS2017 中包含 rapidjson 库

    android - 如何使用 "repo init -m"切换 list

    azure - Service Fabric 中每个服务的应用程序

    java - 使用 Java SDK 查询 Azure 文件墙数据?

    c# - 如何使用 ADAL/OpenId 获取 azure AAD 中的当前用户?

    powershell - 运行在虚拟机上执行 PowerShell 命令的 Azure Runbook 时出错

    azure - 程序 '[1684] dotnet.exe' 已退出,代码为 -2147450750 (0x80008082)

    asp.net-mvc - Entity Framework 6 提供开箱即用的存储库和 UoW

    svn - 如何设置 SVN 存储库以进行紧急修复?