在 Git 中,您如何检查从命令行推送到 Github 中的哪个存储库?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/33850804/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 03:43:05  来源:igfitidea点击:

In Git how can you check which repo in Github you are pushing to from the command line?

gitgithubgit-bash

提问by V.Villacis

I have several projects I am working on. I am constantly pulling and pushing. Recently I made some changes to one of my files, added and committed and decided to push my project A, however it pushed into my Github Project B. I then did git pull for kicks and it this happened.

我有几个项目正在做。我不断地拉和推。最近我对我的一个文件进行了一些更改,添加并提交并决定推送我的项目 A,但是它推送到我的 Github 项目 B。然后我做了 git pull for kicks 并且它发生了。

  • branch master -> FETCH_HEAD Already up-to-date.
  • 分支主 -> FETCH_HEAD 已经是最新的。

It did not pull none of my files from Project B. I then did git status and it showed every single file/folders in my directory as needing to be committed. How would I know which "init" I am on? How can I switch out of this state and how can I disregard these blind commits without losing my files?

它没有从项目 B 中提取我的任何文件。然后我做了 git status 并显示我目录中的每个文件/文件夹都需要提交。我怎么知道我在哪个“init”上?我怎样才能退出这种状态,怎样才能在不丢失我的文件的情况下忽略这些盲目提交?

回答by TLJ

I think you need to reconfig git remote

我认为你需要重新配置 git remote

type git remote -vand see if there's a mismatch or not.
If there is, follow this instruction from github: https://help.github.com/articles/changing-a-remote-s-url/

键入git remote -v并查看是否存在不匹配。
如果有,请按照 github 中的说明进行操作:https: //help.github.com/articles/changed-a-remote-s-url/

回答by Farhad Faghihi

You can check the configs of your repository by :

您可以通过以下方式检查存储库的配置:

git config -l

which contains your remote repository url.

其中包含您的远程存储库 url。

Also, you can use the following command :

此外,您可以使用以下命令:

git remote -v