配置/初始化不推动回购 [英] Config/initializers not pushing to repo

查看:127
本文介绍了配置/初始化不推动回购的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

解决方法如下:为什么git会说如果我的存储库中没有任何子模块,那么子项目就会变得很脏?






所以我遵循Michael Hartl的Rails教程。当我意识到我的应用程序不适用于Heroku时,我大概有五章。我回顾一下,我发现我的整个 config / initializers 文件夹不在我的回购库中,正如您在这里看到的那样: https://github.com/ksin/sample_app/tree/master/config



显然,该文件夹存在于我的工作区中。



$ git status #=>不显示任何内容。



当我在初始化器中修改一个文件并运行 $ git status config / initializers 。但是,我根本无法进行变革。 (正如我将运行 $ git add。但是当我运行 $ git status 之后,非挂接文件是)



我不确定问题所在,因为这在我之前从未发生过。



搜索了一些后,我也做了:
$ git submodule #=> 没有在.gitmodules中为path'config找到子模块映射/ initializers'



这是否意味着什么?

解决方案 DIV>

大!你究竟如何做到这一点?我将来如何解决它?
只是想向您展示另一个技巧:覆盖目标目录,为初始化程序使用另一个技巧:

  module SampleApp 
class Application< Rails :: Application
config.paths ['config / initializers'] = Rails.root.join('bin','initializers')
...

现在,RAILS_ROOT / bin / initializers是你的。



当然,它是非常可怕,但是,如果您现在需要快速修复,则可以执行此技巧,并在稍后执行修复。 :)

Solution here: Why does git say a sub project is dirty if I do not have any sub-modules in my repository?


So I'm following Michael Hartl's Rails tutorial. I'm about five chapters in when I realized my app isn't working on Heroku. I look back a little and I realize that my entire config/initializers folder isn't in my repo, as you can see here: https://github.com/ksin/sample_app/tree/master/config

Clearly, the folder exists in my workspace.

$git status #=> shows nothing to commit.

When I alter a file in initializers and run $git status, config/initializers appears as modified content. However, I can't stage the change at all. (As in I'll run $git add . but when I run $git status afterwards, the unstaged file is still there.)

I'm unsure what the problem is as this has never happened to me before.

After searching some more, I also did: $git submodule #=> No submodule mapping found in .gitmodules for path 'config/initializers'

Does this mean anything?

解决方案

Great! How you actually do it? How can I solve it in future? Just want to show you another trick: override the target directory, to use another for initializers:

 module SampleApp
    class Application < Rails::Application
      config.paths['config/initializers'] = Rails.root.join('bin', 'initializers')
      ...

Now, RAILS_ROOT/bin/initializers is yours..

Of course, it is very horrible, however if you need a quick fix right now, you can do this trick, and perform repairing later. :)

这篇关于配置/初始化不推动回购的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆