问题
I'm using the .gitignore
file below with the hope that when I push my application, the tmp directory and swap files will be ignored. That isn't happening though and now I am wondering if cf push
even considers .gitignore
?
*.swp
tmp/
Does anyone know if cf push
takes a .gitignore
file into consideration?
回答1:
The file .cfignore
is used for that purpose -- it is not the same as .gitignore
, but rather its analogy for the cf
tool.
The reason for not using them for the same purpose is that you may have for example files that are used for your build (or even source code!) that go to Git but not to the Bluemix runtime, and alternatively, other files like credentials or configurations which are to be deployed with the app but still not go to Git. (You would use .cfignore
to exclude the first set, and .gitignore
in the other case.)
回答2:
I discovered that cf push
does NOT use .gitignore
rather it uses its own file called .cfignore
that has to be placed at the root directory of the application you are pushing.
The rules for .cfignore
and .gitignore
appear to tbe the same. (one pattern per line) However since the .cfignore
file must be at the root of the applicaiton the patterns in the file must take that into consideration.
Using the file above I am now able to push my application without all the .swp
files or anything in my <application-root>/tmp
directory.
来源:https://stackoverflow.com/questions/30175601/does-cf-push-respect-the-use-of-gitignore