Git如何检查连接到哪个repo项目

kos*_*sas 6 git android-studio

我在使用时如何检查连接了哪个 repo 项目android studio

我在 中创建了一个新bitbucket存储库,拉取了该新存储库并将连接到另一个存储库的旧项目复制到该文件夹​​,现在我想确保我将推送到正确的存储库。

小智 11

您应该能够通过单击VCS > Git > Remotes来查看您的远程存储库。

在 Android Studio 中,您还可以单击 Console 选项卡以打开终端。如果您已设置远程存储库,git remote -v将列出它们及其名称。

为确保推送到正确的存储库,只需确保在执行此操作时使用此列表中的正确存储库名称。

您的输出可能很简单

origin  https://github.com/username/myrepo (fetch)
origin  https://github.com/username/myrepo (push)
Run Code Online (Sandbox Code Playgroud)

在这种情况下git push origin master将推送到myrepo.

如果您有多个远程存储库,它可能看起来像

origin  https://github.com/username/myrepo (fetch)
origin  https://github.com/username/myrepo (push)
repo2   https://github.com/username2/anotherrepo (fetch)
repo2   https://github.com/username2/anotherrepo (push)
Run Code Online (Sandbox Code Playgroud)

在这种情况下,您可以根据要提交更改的位置在 push 命令中使用originrepo2