【问题标题】:Using GIT Bash, ERROR: Repository not found - fatal: Could not read from remote使用 GIT Bash,错误:找不到存储库 - 致命:无法从远程读取
【发布时间】:2015-01-17 00:00:47
【问题描述】:

我朋友在 Git 存储库中的项目,已经下载了“Git-1.9.4-preview20140929.exe”并安装了 GIT bash 以将项目拉到我的最后,我使用了

$ git clone <with SSH clone URL>

我在本地系统中获得了项目,并且做了一些更改现在我想将更改推送回存储库,所以我这样做了

$ git init
Reinitialized existing Git repository in c:/users....

$ git add .
$ pom.xml
./pom.xml: line 1: project: No such file or directory
./pom.xml: line 2: syntax error near unexpected token `newline'
./pom.xml: line 2: `  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http
://maven.apache.org/maven-v4_0_0.xsd">'

 $ git commit -m 'First commit'
 On branch master
 Your branch is ahead of 'origin/master' by 2 commits.
   (use "git push" to publish your local commits)

 nothing to commit, working directory clean

$ git push -u origin master:master
Enter passphrase for key '/h/.ssh/id_rsa':
ERROR: Repository not found.
fatal: Could not read from remote repository.

 Please make sure you have the correct access rights
 and the repository exists.

 $ git push origin master
 Enter passphrase for key '/h/.ssh/id_rsa':
 ERROR: Repository not found.
 fatal: Could not read from remote repository.

 Please make sure you have the correct access rights
 and the repository exists.

他们中的大多数人有同样的问题(以前的 Stack Overflow 问题/答案)但原因不同,并且尝试了这些答案但无法修复错误,请给我指示,谢谢!

【问题讨论】:

  • 你为什么要做git init?一个 git clone 已经给了你一个 repo。无需再次初始化。
  • 谢谢@VonC,我正在关注一份文档,你认为这是问题吗?没有 $ git init 会从头开始,
  • 你做了一个git-cmd.bat?你不必做一个。它已经在那里,您确实在其中安装了适用于 Windows 的 Git。例如,在我的 PC 上,它位于 c:\prgs\git\PortableGit-1.9.0-preview20140217\git-cmd.bat。它的内容看起来像github.com/msysgit/msysgit/blob/master/git-cmd.bat。 “Git for Windows”来自github.com/msysgit/msysgit/releases/tag/…
  • 你做了一个git-cmd.bat?你不必做一个。它已经在那里,您确实在其中安装了适用于 Windows 的 Git。例如,在我的 PC 上,它位于 c:\prgs\git\PortableGit-1.9.0-preview20140217\git-cmd.bat。它的内容看起来像github.com/msysgit/msysgit/blob/master/git-cmd.bat。 “Git for Windows”来自github.com/msysgit/msysgit/releases/tag/…
  • 简单的解决方案:获取github.com/msysgit/msysgit/releases/download/…,将其解压缩到您想要的任何位置,然后在其中找到git-cmd.bat。使用它打开一个 cmd 会话,其中将定义 HOME,并将 git 添加到 PATH 中。

标签: git github git-bash


【解决方案1】:

the chat之后,配置与github链接的正确方法是:

cd c:\Users\ramas\dmsproject\dms
git remote set-url origin git@github.com:vamsiannem/dms.git

然后git push 可以工作。

【讨论】:

    【解决方案2】:

    我也遇到了这个问题,但最后我找到了已编辑但未在我的工作区提交的文件。所以在我提交之后,就像这样:

    然后我用git push -u origin master就完了!

    【讨论】:

      猜你喜欢
      • 2019-10-24
      • 2012-11-10
      • 1970-01-01
      • 2015-01-19
      • 1970-01-01
      • 2014-03-01
      • 1970-01-01
      • 2022-10-23
      • 2012-04-15
      相关资源
      最近更新 更多