使用GIT Bash时出现错误:仓库未找到 - 致命错误:无法从远程读取

3

我的朋友的项目在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

and

$ 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-cmd.bat,如https://dev59.com/pHbZa4cB1Zd3GeqPHZIl#18679161或http://stackoverflow.com/a/15217630/6309:然后您可以检查HOME是否正确设置。 然后,您可以检查%HOME%/.ssh是否存在。 然后您可以再次联系我。 git-cmd.bat已打包在您的msysgit发行版中。 - VonC
1
你做了一个git-cmd.bat?其实不需要自己做,因为在安装Git for Windows的时候它就已经存在了。例如,在我的电脑上,它位于 c:\prgs\git\PortableGit-1.9.0-preview20140217\git-cmd.bat。其内容看起来像是这样 https://github.com/msysgit/msysgit/blob/master/git-cmd.bat。"Git for Windows" 来自于这里 https://github.com/msysgit/msysgit/releases/tag/Git-1.9.4-preview20140929。 - VonC
1
你做了一个git-cmd.bat吗?你不需要自己制作。它已经存在于你安装Git for Windows的地方。例如,在我的电脑上,它在c:\prgs\git\PortableGit-1.9.0-preview20140217\git-cmd.bat。它的内容看起来像https://github.com/msysgit/msysgit/blob/master/git-cmd.bat。“Git for Windows”来自https://github.com/msysgit/msysgit/releases/tag/Git-1.9.4-preview20140929。 - VonC
1
简单的解决方案:下载 https://github.com/msysgit/msysgit/releases/download/Git-1.9.4-preview20140929/PortableGit-1.9.4-preview20140929.7z,将其解压到任意位置,在其中找到 git-cmd.bat。使用该文件打开一个 cmd 会话,其中 HOME 将被定义,并且 git 已经被添加到 PATH 中。 - VonC
让我们在聊天中继续这个讨论 - VonC
显示剩余6条评论
2个回答

12

聊天之后,正确配置与github的链接方式是:

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

然后执行 git push 命令即可。


0

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

enter image description here

然后我使用git push -u origin master,完成了!


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