Capistrano downloads the .git directory

I am using git with capistrano.

I initialized my project inside my folder on my local machine as such:

git init 

Then I clicked on the project server directory. Then I called cap deploy Deployment works, except that it loads the local folder structure .git, as well as my .gitignore and Capfile into the public folder.

Here is my gitignore file:

 .DS_Store uploads/**/* Capfile .gitignore .git/**/* 

This is not like a trick. Any help?

Thanks!


Edit: Updated .gitignore file:

Deployment strategy for export has been changed:

 set :deploy_via, :export 

This works to ignore the .git folder, but the contents of my .gitignore file shown below are still not taken into account

 .DS_Store includes/php/config.php /uploads Capfile .git 





EDIT 2 (Decision): Change 1 in combination with the following trick. Files that were added before they were added to the .gitignore file will be constantly downloaded. Let's say I had the following .gitignore file.

 .DS_Store includes/php/config.php 

Then I executed the following commands:

 git add . git commit -a -m 'some commit' 

Then I decided to add .gitignore to my file so that it now looks like this:

 .DS_Store includes/php/config.php Capfile 

Then again I ran:

 git add . git commit -a -m 'another commit' 

Now I see that .DS_Store and includes/php/config.php were not loaded, but that Capfile has ... Here is what happened to me in my original question. Reason: I think the .gitignore file is only taken into account when adding (i.e. git add . ). If I had already added the files and then placed them in a .gitignore file, they would have already been added to the project. I will need to use the git rm command to remove them. I just started over from the new .git repository and this solved the problem, but you don’t need to - you can just delete all the files that you have already added, but now you want to ignore the git rm command.

I chose the answer that helped me come to this conclusion as the right one, although the complete solution was just described in detail above.

+6
git version-control php deployment capistrano
source share
2 answers

What is the deployment strategy?

Do you have a Capistrano setting to exclude a .git file? if you use set :deploy_via, :copy , be sure to add the following:

set :copy_exclude, [".git/*", ".svn/*", ".DS_Store"]

Otherwise, use set :deploy_via, :export , which should ignore your source control folders

http://www.capify.org/index.php/Understanding_Deployment_Strategies

+16
source share

Considering a similar question , it seems that you do not need wild card selectors and may just have:

 uploads/ 

You need to deploy via :git to Capistrano and export. This is essentially a git clone and then just removes the .git directory.

Your problem is not very important for Cap. Make sure your .gitignore file .gitignore working correctly.

+1
source share

All Articles