简体   繁体   English

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

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

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.它没有从项目 B 中提取我的任何文件。然后我做了 git status 并显示我目录中的每个文件/文件夹都需要提交。 How would I know which "init" I am on?我怎么知道我在哪个“init”上? How can I switch out of this state and how can I disregard these blind commits without losing my files?我怎样才能退出这种状态,怎样才能在不丢失我的文件的情况下忽略这些盲目提交?

I think you need to reconfig git remote 我想你需要重新配置git remote

type git remote -v and see if there's a mismatch or not. 输入git remote -v并查看是否存在不匹配。
If there is, follow this instruction from github: https://help.github.com/articles/changing-a-remote-s-url/ 如果有,请按照github的说明操作: https//help.github.com/articles/changing-a-remote-s-url/

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

If you want to change the name type如果要更改名称类型

  1. git remote -v git远程 -v
  2. git remote rename OLDNAME NEWNAME git remote 重命名 OLDNAME NEWNAME

If it doesnt accept commits after this.如果在此之后它不接受提交。 You can try你可以试试

git pull NEWNAME main git pull NEWNAME 主

git push NEWNAME main git push NEWNAME 主

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从 Matlab 推送本地 git 存储库失败:您无法推送到 git://github.com/user/repo.git 使用 https://github.com/user/repo.git - Pushing local git repository from Matlab fails: You can't push to git://github.com/user/repo.git use https://github.com/user/repo.git 如何判断你是否在git-svn repo命令行中? - How to tell if you're in a git-svn repo command line? 您可以从 GitHub 上的命令行发出拉取请求吗? - Can you issue pull requests from the command line on GitHub? 如何通过命令行将密码传递给GIT? - How can you pass password to GIT on the command line? 推送到 GitHub 上的 repo 时身份验证失败(来自 GitHub 桌面和命令行) - Authentication failed when pushing to repo on GitHub (from GitHub Desktop & command line) 在 Git 中,如何从“.repo”目录中提取项目以便进行处理? - In Git, how do you extract a project from a ".repo" directory so you can work on it? git 克隆命令行不适用于 github 上的存储库 - git clone command line is not working for a repo on github 您可以从Team Services git repo中`npm install`吗? - Can you `npm install` from Team Services git repo? 你能确定从仓库中复制的文件的git版本吗? - Can you determine the git version of a file copied from a repo? Git:如何在同一个 repo 中管理多个相关项目? - Git: How can you manage multiple related projects in the same repo?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM