fatal: 似乎不是 git 存储库

发布于 2024-12-03 12:57:04 字数 1846 浏览 0 评论 0原文

当我的 Git 存储库 URL 正确时,为什么会收到此错误?

fatal: '[email protected]/gittest.git' does not appear to be a git repository
fatal: The remote end hung up unexpectedly

请在下面的上下文中查看它,或屏幕截图

jitendra@JITENDRA-PC /c/mySite (master)
$ git push beanstalk master
fatal: '[email protected]/gittest.git' does not appear to be a git repository
fatal: The remote end hung up unexpectedly

jitendra@JITENDRA-PC /c/mySite (master)
$ git clone git://github.com/jquery/jquery.git
Cloning into jquery...
Remote: Counting objects: 19803, done.
Remote: Compressing objects: 100% (5196/5196), done.
Remote: Total 19803 (delta 14204), reused 19549 (delta 14052)
Receiving objects: 100% (19803/19803), 12.80 MiB | 591 KiB/s, done.
Resolving deltas: 100% (14204/14204), done.

jitendra@JITENDRA-PC /c/mySite (master)
$ gitk --all

jitendra@JITENDRA-PC /c/mySite (master)
$ gitk -all

jitendra@JITENDRA-PC /c/mySite (master)
$ git remote add origin [email protected]/gittest.git

jitendra@JITENDRA-PC /c/mySite (master)
$ git push origin master
fatal: '[email protected]/gittest.git' does not appear to be a git repository
fatal: The remote end hung up unexpectedly

jitendra@JITENDRA-PC /c/mySite (master)

Why am I getting this error when my Git repository URL is correct?

fatal: '[email protected]/gittest.git' does not appear to be a git repository
fatal: The remote end hung up unexpectedly

See it in context below, or as a screenshot.

jitendra@JITENDRA-PC /c/mySite (master)
$ git push beanstalk master
fatal: '[email protected]/gittest.git' does not appear to be a git repository
fatal: The remote end hung up unexpectedly

jitendra@JITENDRA-PC /c/mySite (master)
$ git clone git://github.com/jquery/jquery.git
Cloning into jquery...
Remote: Counting objects: 19803, done.
Remote: Compressing objects: 100% (5196/5196), done.
Remote: Total 19803 (delta 14204), reused 19549 (delta 14052)
Receiving objects: 100% (19803/19803), 12.80 MiB | 591 KiB/s, done.
Resolving deltas: 100% (14204/14204), done.

jitendra@JITENDRA-PC /c/mySite (master)
$ gitk --all

jitendra@JITENDRA-PC /c/mySite (master)
$ gitk -all

jitendra@JITENDRA-PC /c/mySite (master)
$ git remote add origin [email protected]/gittest.git

jitendra@JITENDRA-PC /c/mySite (master)
$ git push origin master
fatal: '[email protected]/gittest.git' does not appear to be a git repository
fatal: The remote end hung up unexpectedly

jitendra@JITENDRA-PC /c/mySite (master)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(10

梨涡少年 2024-12-10 12:57:04

您的 scp 式指定存储库的语法有点错误 - 它必须是:

[user@]host.xz:path/to/repo.git/

... 正如您在 git 克隆 文档。您应该使用 URL:

[email protected]:/gittest.git

即在您使用的 URL 中,您错过了 : (冒号)

要更新您可以执行的原点 URL:

git remote set-url origin [email protected]:/gittest.git

You've got the syntax for the scp-style way of specifying a repository slightly wrong - it has to be:

[user@]host.xz:path/to/repo.git/

... as you can see in the git clone documentation. You should use instead the URL:

[email protected]:/gittest.git

i.e. in the URL you're using, you missed out the : (colon)

To update the URL for origin you could do:

git remote set-url origin [email protected]:/gittest.git
萌无敌 2024-12-10 12:57:04

当我尝试将现有存储库存储在我的 Ubunt One 帐户中时,我遇到了类似的问题,我通过以下步骤修复了该问题:

步骤 1:创建远程存储库

$ cd ~/Ubuntu\ One/
$ mkdir <project-name>
$ cd <project-name>
$ mkdir .git
$ cd .git
$ git --bare init

步骤 2:添加远程

$ git remote add origin /home/<linux-user-name>/Ubuntu\ One/<project-name>/.git

第3步:将现有的git reop推送到远程

$ git push -u origin --all

I met a similar problem when I tried to store my existing repo in my Ubunt One account, I fixed it by the following steps:

Step-1: create remote repo

$ cd ~/Ubuntu\ One/
$ mkdir <project-name>
$ cd <project-name>
$ mkdir .git
$ cd .git
$ git --bare init

Step-2: add the remote

$ git remote add origin /home/<linux-user-name>/Ubuntu\ One/<project-name>/.git

Step-3: push the exising git reop to the remote

$ git push -u origin --all
归途 2024-12-10 12:57:04

这通常是因为您尚未在 Git 存储库上设置原始别名。

尝试

git remote add origin URL_TO_YOUR_REPO

此操作将在您的 .git/config 文件中为远程克隆/推送/拉取站点 URL 添加别名。该 URL 可以在您的存储库概述页面上找到。

This is typically because you have not set the origin alias on your Git repository.

Try

git remote add origin URL_TO_YOUR_REPO

This will add an alias in your .git/config file for the remote clone/push/pull site URL. This URL can be found on your repository Overview page.

友谊不毕业 2024-12-10 12:57:04

我的本地和远程机器都是 OS X。直到我检查了 xCode Server 为我提供的 git 存储库的文件结构之前,我遇到了麻烦。本质上,该存储库中的所有内容都是 chmod 777 *,因此要在我的远程帐户中的同一台计算机上设置单独的非 xCode 存储库,我这样做了:

远程计算机

  1. 登录到您的帐户
  2. 为所有项目创建一个主目录 'mkdir git'
  3. chmod 775 git然后 cd 进入它
  4. 创建一个项目文件夹 'mkdir project1'
  5. chmod 777 project1 然后 cd 进入它
  6. 运行命令 'git init' 以使repo
  7. 这会创建一个 .git 目录。执行命令 'chmod 777 .git' 然后 cd 进入其中
  8. 运行命令 'chmod 777 *' 使 .git 777 mod
  9. cd 中的所有文件返回到 myproject1 (cd ..)
  10. 在新存储库中设置一个测试文件 w/command ' touch test.php'
  11. 使用命令 'git add test.php' 将其添加到存储库暂存区域
  12. 运行命令“git commit -m 'new file'”将文件添加到存储库
  13. 运行命令'git status',你应该得到“working dir clean”msg
  14. cd回到主目录,
  15. 在主目录中使用'cd ..'创建一个符号链接'ln -s project1 project1.git'
  16. 运行命令'pwd'来获取完整路径
  17. 在我的例子中,完整路径是“/Users/myname/git/project1.git”
  18. 写下完整路径,以便稍后在
  19. 远程计算机退出的

URL 中使用本地计算机

  1. 创建项目文件夹在“newproj1”的某个地方,将“mkdir newproj1”
  2. cd到其中,
  3. 运行命令“git init”,
  4. 为远程计算机创建一个别名,
  5. 别名命令格式为“git远程添加your_alias_here URL”,
  6. 确保您的URL正确,这最初让我头疼
  7. 。 = 'ssh://[email protected]/Users/myname/git/project1.git'
  8. 在执行 'git remote add alias URL' 后执行 'git remote -v'
  9. 命令应响应获取和推送行
  10. 运行 cmd 'git pull 。
  11. 在 #10 中的命令之后,您应该会看到一条不错的消息
  12. 运行命令 'git push --set-upstream your_alias master'
  13. 在 12 中的命令之后
  14. 你应该在 #12 中看到不错的消息命令将 REMOTE 设置为项目主控(root)

对于我来说,我学会了通过 git repo 重新开始LOCAL 和 REMOTE 需要首先在 shell 中进行所有初始工作。那么,经过上述
我能够在 IDE 中轻松设置本地和远程 git 存储库,并使用 IDE 的 GUI 执行所有基本 git 命令。

我遇到了困难,直到我先从远程开始,然后进行本地,直到我打开远程上的所有权限。此外,在 URL 中提供符号链接的准确完整路径对于成功至关重要。

同样,这一切都适用于 OS X、本地和远程计算机。

my local and remote machines are both OS X. I was having trouble until I checked the file structure of the git repo that xCode Server provides me. Essentially everything is chmod 777 * in that repo so to setup a separate non xCode repo on the same machine in my remote account there I did this:

REMOTE MACHINE

  1. Login to your account
  2. Create a master dir for all projects 'mkdir git'
  3. chmod 775 git then cd into it
  4. make a project folder 'mkdir project1'
  5. chmod 777 project1 then cd into it
  6. run command 'git init' to make the repo
  7. this creates a .git dir. do command 'chmod 777 .git' then cd into it
  8. run command 'chmod 777 *' to make all files in .git 777 mod
  9. cd back out to myproject1 (cd ..)
  10. setup a test file in the new repo w/command 'touch test.php'
  11. add it to the repo staging area with command 'git add test.php'
  12. run command "git commit -m 'new file'" to add file to repo
  13. run command 'git status' and you should get "working dir clean" msg
  14. cd back to master dir with 'cd ..'
  15. in the master dir make a symlink 'ln -s project1 project1.git'
  16. run command 'pwd' to get full path
  17. in my case the full path was "/Users/myname/git/project1.git'
  18. write down the full path for later use in URL
  19. exit from the REMOTE MACHINE

LOCAL MACHINE

  1. create a project folder somewhere 'newproj1' with 'mkdir newproj1'
  2. cd into it
  3. run command 'git init'
  4. make an alias to the REMOTE MACHINE
  5. the alias command format is 'git remote add your_alias_here URL'
  6. make sure your URL is correct. This caused me headaches initially
  7. URL = 'ssh://[email protected]/Users/myname/git/project1.git'
  8. after you do 'git remote add alias URL' do 'git remote -v'
  9. the command should respond with a fetch and push line
  10. run cmd 'git pull your_alias master' to get test.php from REMOTE repo
  11. after the command in #10 you should see a nice message.
  12. run command 'git push --set-upstream your_alias master'
  13. after command in 12 you should see nice message
  14. command in #12 sets up REMOTE as the project master (root)

For me, i learned getting a clean start with a git repo on a LOCAL and REMOTE requires all initial work in a shell first. Then, after the above
i was able to easily setup the LOCAL and REMOTE git repos in my IDE and do all the basic git commands using the GUI of the IDE.

I had difficulty until I started at the remote first, then did the local, and until i opened up all the permissions on remote. In addition, having the exact full path in the URL to the symlink was critical to succeed.

Again, this all worked on OS X, local and remote machines.

一笑百媚生 2024-12-10 12:57:04

您很可能弄错了存储库的 SSH URL。

要进行确认,请转到 Github 上的存储库,然后单击克隆或下载按钮。然后单击使用 SSH 链接。

ssh 链接

现在复制您的官方存储库的 SSH 链接。我的看起来像这样 - [email protected]:borenho/que -ay.git

您现在可以执行git Remote add origin [电子邮件受保护]:borenho/que-ay.git 如果您还没有origin

如果您之前设置了 origin,请使用 git remote set-url origin [email protected]:borenho/que-ay.git

现在使用 git push -u origin master 进行推送

It is most likely that you got your repo's SSH URL wrong.

To confirm, go to your repository on Github and click the clone or download button. Then click the use SSH link.

ssh link

Now copy your official repo's SSH link. Mine looked like this - [email protected]:borenho/que-ay.git

You can now do git remote add origin [email protected]:borenho/que-ay.git if you didn't have origin yet.

If you had set origin before, change it by using git remote set-url origin [email protected]:borenho/que-ay.git

Now push with git push -u origin master

浅浅淡淡 2024-12-10 12:57:04

我的一个功能分支也面临着同样的问题。我尝试了上述解决方案,但没有任何效果。我通过执行以下操作解决了这个问题。

  • git pull origin 功能分支名称
  • git push

I was facing same issue with my one of my feature branch. I tried above mentioned solution nothing worked. I resolved this issue by doing following things.

  • git pull origin feature-branch-name
  • git push
治碍 2024-12-10 12:57:04

我在使用 TFS 2017 时遇到了类似的问题。我无法推送或拉取 GIT 存储库。最终我重新安装了 TFS 2017,确保使用不同于 22 的 SSH 端口安装 TFS 2017(在我的例子中,我选择了 8022)。之后,可以使用 SSH 对 TFS 进行推送和拉取。

I had a similar problem when using TFS 2017. I was not able to push or pull GIT repositories. Eventually I reinstalled TFS 2017, making sure that I installed TFS 2017 with an SSH Port different from 22 (in my case, I chose 8022). After that, push and pull became possible against TFS using SSH.

伴我心暖 2024-12-10 12:57:04

这些对我来说都不起作用。问题似乎更加平凡......

我花了大约一天的时间才弄清楚我的 Synology 卷的名称不是“Volume1”而是“volume1”。

考虑到 URL 通常不区分大小写,Windows 文件路径也不区分大小写,最后但并非最不重要的一点是:DSM 用户界面(例如 Hyper Backup)中对volume1 的引用都是大写的! (让他们看起来好看?)。我终于在 SSH 中发现它在更改目录时注意到大小写很重要。指定远程存储库的 URL 时也是如此。

None of this worked for me. The problem appeared to be a lot more mundane...

I spent about a day figuring out the name of my Synology volume is not "Volume1" but "volume1".

I do not feel that stupid about it considering URLs are typically not case sensitive, Windows file paths are not case sensitive and last but not least: references to volume1 in the DSM user interface (e.g. Hyper Backup) are capitalized! (to make them look nice?). I finally found it poking around in SSH noticing that casing mattered when changing directories. And so it does when specifying the URL for the remote repository.

梦里兽 2024-12-10 12:57:04

我遇到了类似的问题。
就我而言,要解决的问题是取消设置环境变量 HOMEBREW_BREW_GIT_REMOTE。

unset HOMEBREW_BREW_GIT_REMOTE

I got similar issue.
In my case to solve was to unset the environment variable HOMEBREW_BREW_GIT_REMOTE.

unset HOMEBREW_BREW_GIT_REMOTE
妖妓 2024-12-10 12:57:04

我也有类似的问题,但现在我知道原因了。

当我们使用git init之后,我们应该添加一个远程仓库,

git remote add name url

注意name这个词,如果我们把它改成origin,那么这个问题不会发生。

当然,如果我们将其更改为py,那么每次拉动和推送东西时都使用git pull pybranchgitpush pybranch也可以。

I have a similar problem, but now I know the reason.

After we use git init, we should add a remote repository using

git remote add name url

Pay attention to the word name, if we change it to origin, then this problem will not happen.

Of course, if we change it to py, then using git pull py branch and git push py branch every time you pull and push something will also be OK.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文