【发布时间】: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中。