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

10

我在使用 android studio 时,如何检查连接的是哪个代码仓库项目?

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


5
展示远程仓库 "origin" 的详细信息。 - IsaiahJ
3
git remote -v 列出了远程名称及其URL。 - axiac
1个回答

21

点击 VCS > Git > Remotes,您应该能够查看您的远程仓库。

在Android Studio中,您还可以点击“控制台”选项卡以打开终端。如果您已经设置了远程仓库,git remote -v命令将会列出它们及其名称。

为确保向正确的仓库推送代码,请在推送时确保使用此列表中正确的仓库名称。

您的输出可能只是简单的:

origin  https://github.com/username/myrepo (fetch)
origin  https://github.com/username/myrepo (push)

如果你有多个远程仓库,可能会像这样:

那么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)

如果是这种情况,您可以根据您想提交更改的位置,在您的推送命令中使用originrepo2


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接