Ruby-on-rails 致命:不是 git 存储库(或任何父目录):.git

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13888972/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 21:11:34  来源:igfitidea点击:

fatal: Not a git repository (or any of the parent directories): .git

ruby-on-railsheroku

提问by Simon Yu

I got the following when I try to git push to heroku

当我尝试 git push 到 heroku 时,我得到了以下信息

fatal: Not a git repository (or any of the parent directories): .git

I try to follow ruby on rail tutorial book.

我尝试遵循 ruby​​ on rail 教程。

I think I installed the client heroku package(by downloading from heroku website and follow their instruction to install, GUI format installation). So my client side heroku should be ok (I am new to programming , so not sure if saying by this term is correct or not).

我想我安装了客户端 heroku 包(通过从 heroku 网站下载并按照他们的说明进行安装,GUI 格式安装)。所以我的客户端 heroku 应该没问题(我是编程新手,所以不确定这个术语是否正确)。

Then I open a new terminal and key in

然后我打开一个新终端并输入

git push heroku master

I got

我有

fatal: Not a git repository (or any of the parent directories): .git

Can anyone good at this explain which part I missed? i.e. have to move to some directory first?

任何擅长这方面的人都可以解释我错过了哪一部分吗?即必须先移动到某个目录?

Please show me the command since I might still have no idea without command.

请告诉我命令,因为如果没有命令我可能仍然不知道。

PS: I think I have repository in my github already.

PS:我想我的github中已经有存储库了。

回答by pjammer

you aren't on a git repository directory.

您不在 git 存储库目录中。

type pwdand make sure it's where you think you should be. chances are you are in ~/or something just before the directory you think you are in.

输入pwd并确保它位于您认为应该位于的位置。~/很有可能你在你认为你所在的目录之前。

回答by Fiona T

Have you created a git repository? Create it using git initand then commit some files.

您是否创建了 git 存储库?使用创建它git init,然后提交一些文件。

http://git-scm.com/book/en/Git-Basics-Getting-a-Git-Repository

http://git-scm.com/book/en/Git-Basics-Getting-a-Git-Repository

回答by Prakash Murthy

Make sure you have followed all the steps in the Installation and setupsection of the Rails Tutorial book.

确保您已遵循Rails 教程书的安装和设置部分中的所有步骤。

The error message you are getting is indicating that you have missed the git initstep.

您收到的错误消息表明您错过了该git init步骤。

回答by Mani

This error comes because you are trying to push the changes from a non-cloned working copy of your git repository. have you initialized git repo on the dir that you are working?? if not so initialize git repo by using git initand then either do a git cloneor add a remote by using git remote add origin [email protected]:repourl.gitfor more detail refer this

出现此错误是因为您试图从 git 存储库的非克隆工作副本推送更改。你有没有在你正在工作的目录上初始化 git repo ?如果不是这样,请通过使用初始化 git repo git init,然后通过使用执行git clone或添加远程操作以git remote add origin [email protected]:repourl.git获取更多详细信息,请参阅

回答by Mahir Islam

This error is most likely to occur if you haven't made the directly with git init. Use git initto make the git directory/folder, it will work.

如果您没有直接使用git init. 使用git init使git的目录/文件夹,它会工作。