【问题标题】:Folder deleted on remote host AWS using git使用 git 在远程主机 AWS 上删除的文件夹
【发布时间】:2012-11-18 05:27:07
【问题描述】:

我正在使用 git 将我的本地文件上传到亚马逊网络服务,我遇到了这个问题:

我在 gitinore 文件中添加了一个文件夹(图像/成员),但是当我执行 git push 时,它在 AWS 上被删除。我只想忽略 images/members 文件夹下的任何文件和子文件夹,因为应用程序会在其下创建动态文件夹。

我做的步骤:

1) 在位于 Web 根目录的 .gitignore 文件中添加以下行:

图片/成员/

2) git 初始化

3) git add .

4) git commit -m "test"

5) git aws.push

我的所有更改都已发布,但文件夹 members 但是当我的应用程序中的成员在 images/members 下创建一个文件夹时,当我执行另一个 git aws.push 时它会被删除。我只想忽略文件夹而不是删除它。

谢谢

【问题讨论】:

  • 我的设置也遇到了同样的问题。我已将敏感数据放入 .gitignore 中的子目录中,因此无法访问,但应用程序需要它(数据库密码等)。每当我执行 git push 时,目录和包含的文件都会被擦除。

标签: git github amazon-web-services


【解决方案1】:

如果 git 已经在跟踪这些文件,那么您必须 git rm 它们然后将它们添加回来。

有可能另一个 .gitignore - 全局或该目录中的设置覆盖了设置,请参阅手册页条目以了解优先级:

order of precedence, from highest to lowest (within one level of precedence, the last matching pattern decides the outcome): Patterns read from the command line for those commands that support them.

   o   Patterns read from a .gitignore file in the same directory as the path, or in any
       parent directory, with patterns in the higher level files (up to the toplevel of the
       work tree) being overridden by those in lower level files down to the directory
       containing the file. These patterns match relative to the location of the .gitignore
       file. A project normally includes such .gitignore files in its repository, containing
       patterns for files generated as part of the project build.

   o   Patterns read from $GIT_DIR/info/exclude.

   o   Patterns read from the file specified by the configuration variable core.excludesfile

【讨论】:

    猜你喜欢
    • 2012-08-25
    • 1970-01-01
    • 2016-03-13
    • 1970-01-01
    • 1970-01-01
    • 2015-09-26
    • 2015-11-15
    • 1970-01-01
    • 2013-08-09
    相关资源
    最近更新 更多