How to use non-text documents, such as docx, exe, or zip with Bitbucket Server and Data Center
Summary
There is often a need to keep all project-related objects, such as Requirements docs, presentations, source code and build executables within Bitbucket, and control their access. These files are typically documents with extensions docx
, pptx
, pdf
or binary files such as exe
, zip
or tar.gz
.
Solution
There is no built-in way in Bitbucket Server itself to recognize or manage these files. However, Git LFS offers commands to manage non-text files. It may not be possible to preview the files in Bitbucket UI. However, they can be downloaded. The files can also be locked using Git LFS locking API (since 6.3) and the locking previewed in UI (since 6.4).
Example:
- Install git-lfs on the client, if not already installed
- Initialize the repository location with LFS
git lfs install
Track your non-text documents with Git LFS
git lfs track "*.docx"
Commit
git add .gitattributes git add *.docx git commit -m "DOCX files now tracked by Git LFS"
Push changes to remote
git push
See Git LFS for more information.