Document .gitignore behaviour
See original GitHub issueDescription
Currently, all files that are set to be ignored in .gitignore will not be deployed by the action. This seems to be caused by the git clone
operation and, while I haven’t been able to find any discussion on this in issues or PRs (I used github’s search tool, so I might be on the wrong here), I think it’s safe to assume that this is the intended behaviour.
I believe that this behaviour could be counterintuitive to some users, so it may be interesting to document it on the readme, or at least discuss the idea here.
Reproduction
- Create a repository that includes a .gitignore file that blacklists some files
- Set up a CI pipeline that deploys the directory that contains the .gitignore file using this action
- Files specified on .gitignore will not be deployed
You can see this behaviour on this CI run.
Reasons why this can be unexpected
I personally got confused by this behaviour, as I expected .gitignored files to be deployed. My thought process went along the lines of:
- People usually deploy build artifacts
- Build artifacts are usually excluded from git through .gitignore
- Thus, .gitignore files are probably not ignored when deploying
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:8 (7 by maintainers)
Top Results From Across the Web
gitignore Documentation - Git
A gitignore file specifies intentionally untracked files that Git should ignore. Files already tracked by Git are not affected; see the NOTES below...
Read more >Ignoring in Git: How To Use .gitignore Files - BMC Software
The .gitignore file tells Git which files to ignore when committing your project to the GitHub repository. gitignore is located in the root ......
Read more >Does git specify recursive behaviour for gitignore patterns?
Suppose that .gitignore consists of the line hello , while dir/.gitignore consists of the line bar . The file hello in both directories...
Read more >How can I ignore a file that has already been committed to a ...
Git can only ignore files that are untracked - files that haven't been committed to the repository, yet. That's why, when you create...
Read more >gitignore examples to ignore files, folder & pattern
The .gitignore is a file containing a list of files or folders that allows you to command Git to pass over/ignore in the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Personally, I am setting up a repository that hosts different projects, and each one of these will have it’s own CI workflow, which publishes the build artifacts to a different subdirectory on gh-pages. I was planning on doing that using
keep_file
on the whole repo (in a manner very similar to what you described in #324), so, at the end of the day, I will be publishing a git repository onpublish_dir
.Now, it’s possible to change the CI to isolate the published subdirectories from the rest of the github repo, but that didn’t seem as something that needed to be done, so I just went ahead with that and got bit by having all of my build artifacts (which are on .gitignores) not be deployed.
With that said, I seem to be the only one that has run into this problem thus far, so I believe it’s fine to not document it, just thought that I would explain my case since other users might run into the same problem.
This is not a bug, sorry for botching the label.