{"meta":{"title":"在 codespace 中协同工作","intro":"可以使用 Live Share 与代码空间 Visual Studio 中的其他人协作。","product":"Codespaces","breadcrumbs":[{"href":"/zh/codespaces","title":"Codespaces"},{"href":"/zh/codespaces/developing-in-a-codespace","title":"在代码空间中开发"},{"href":"/zh/codespaces/developing-in-a-codespace/working-collaboratively-in-a-codespace","title":"协同工作"}],"documentType":"article"},"body":"# 在 codespace 中协同工作\n\n可以使用 Live Share 与代码空间 Visual Studio 中的其他人协作。\n\nVisual Studio Live Share 允许你在代码空间内与其他人实时协作编辑和调试。 可以安全地共享当前 codespace，或访问其他人创建的 codespace。\n\n可以在浏览器中的 Web 客户端或VS Code桌面应用程序中启动 Live Share 会话VS Code。\n\n有关 Live Share 的详细信息，请参阅文档中[的“什么是 Visual Studio Live Share？”](https://learn.microsoft.com/en-us/visualstudio/liveshare/)Visual Studio。\n\n## 与其他人共享你的 codespace\n\n1. 单击活动栏中的“扩展”图标。\n\n2. 在搜索框中，键入“`Live Share`”。\n\n   ![“扩展: 市场”边栏的屏幕截图，搜索框中输入了“live share”。 “Live Share”是扩展列表中的第一个。](/assets/images/help/codespaces/live-share-search-extensions.png)\n\n3. 如果扩展旁边显示“安装”按钮，请单击它，在 codespace 中安装该扩展。\n\n4. 如果扩展在列表中呈灰色，请右键单击它，然后单击“启用”。\n\n   ![“启用”右键单击菜单选项的屏幕截图。](/assets/images/help/codespaces/live-share-enable-rightclick.png)\n\n5. 在活动栏中，单击“Live Share”图标。\n\n   ![活动栏的屏幕截图。 以深橙色边框突出显示了“Live Share”图标（圆圈上方有一个箭头）。](/assets/images/help/codespaces/live-share-click-icon.png)\n\n6. 单击“共享”。\\*\\*\\*\\*\n\n   “toast” 通知消息显示在 VS Code 的右下角，告知代码空间的链接已复制到剪贴板。 如果要阻止来宾更改你与其共享的文件，可单击“设为只读”。\n\n   ![弹出消息“已将邀请链接复制到剪贴板!”的屏幕截图 有三个按钮：“设为只读”、“更多信息”和“再次复制”。](/assets/images/help/codespaces/live-share-link-copied-clipboard.png)\n\n7. 将剪贴板中的链接发送给希望其加入你的 Live Share 会话的任何人。\n\n   > \\[!IMPORTANT]\n   > 考虑到 Live Share 会话可为来宾提供的访问级别，只能与信任的人共享，并应充分考虑共享内容造成的影响。 有关详细信息，请参阅文档中的 [Live Share 的安全功能](https://learn.microsoft.com/en-us/visualstudio/liveshare/reference/security)Visual Studio。\n\n## 停止 Live Share 会话\n\n若要停止共享 codespace，请单击“Live Share”面板中的“停止”图标。\n\n![“Live Share”侧栏中“会话详细信息”右侧的停止图标的屏幕截图。 图标是一个用对角线穿过的圆圈。](/assets/images/help/codespaces/live-share-stop-collaboration.png)\n\n如果你是启动 Live Share 会话的人，并且关闭了 codespace，即使 codespace 在远程主机上仍然活跃，共享会话也会结束。\n\n空闲超时在处于非活动状态一段时间后自动停止 codespace，且仅适用于启动 codespace 的用户。 它不适用于通过 Live Share 在 codespace 上工作的用户。 因此，如果启动 codespace 的用户在配置的时间段内保持非活动状态，则在协作者使用 codespace 时，codespace 可能会超时。 有关详细信息，请参阅“[设置 GitHub Codespaces 超时期限](/zh/codespaces/setting-your-user-preferences/setting-your-timeout-period-for-github-codespaces)”。\n\n## 在他人的代码空间中协同工作\n\n如果要与某人在其创建的 codespace 中协作，请让他们设置 Live Share 会话并向你发送一个链接，如上所述。"}