【问题标题】:Issue adding new local project to a new remote repository将新的本地项目添加到新的远程存储库时出现问题
【发布时间】:2024-01-12 23:14:01
【问题描述】:

我在使用 Git 时遇到了这个奇怪的问题。这就是我所做的:

  • 我在 VS Community 2017 中创建了一个新项目
  • 通过 Git Bash,我在新创建的项目的根目录中执行了 git init
  • 我添加了新文件并进行了一些编码
  • 我在自己的github账号上新建了一个仓库MVVM_Template(和本地项目名一样)
  • 我按照Adding an existing project to GitHub using the command line 中的说明进行操作

结果:

Me@MyPC MINGW64 ~/source/repos/MVVM_Template (master)
$ git remote add origin https://github.com/MeOnGithub/MVVM_Template.git
fatal: remote origin already exists.

Me@MyPC MINGW64 ~/source/repos/MVVM_Template (master)
$ git push -u origin master
remote: Repository not found.
fatal: repository 'https://github.com/MeOnGithub/MVVM-Template.git/' not found

所以远程源已经存在,但是找不到存储库

我该如何解决这个问题?

【问题讨论】:

    标签: git github git-branch git-bash


    【解决方案1】:

    我觉得你拼错了什么?看起来实际存储库的名称与您将遥控器设置为的名称不同。是MVVM_Template 还是MVVM-Template

    【讨论】:

    • 它是下划线而不是破折号,无论是在本地还是在存储库上。但它错误地显示为破折号。嗯,我会尝试删除它。感谢您指出。
    • 我删除了破折号和下划线,它确实有效。这很奇怪,谢谢。
    • 它绝对应该与破折号或下划线一起使用。如果您是手动输入的,我怀疑您在最初输入git remote add origin 时可能不小心使用了破折号。无论如何,我很高兴你解决了这个问题!
    • *.com/questions/48958546/… 也许你能帮忙? :)
    • 没有足够的代表来评论您的其他帖子。如果您能详细说明“我还没有成功”,那将会很有帮助。你在哪里卡住了?你遇到了什么错误?您没有提到为 CoffeeMaker 存储库设置遥控器
    最近更新 更多