使用git在远程主机AWS上删除文件夹

时间:2012-11-16 17:03:51

标签: git github amazon-web-services

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

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

我做的步骤:

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

images / members /

2)git init

3)git add。

4)git commit -m“test”

5)git aws.push

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

由于

1 个答案:

答案 0 :(得分:0)

如果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