Git - Ignore Files, Directories, Permissions | Drupal 8

Git - Ignore Files, Directories, Permissions

Submitted by editor on Fri, 06/10/2016 - 09:57
Question

What are the methodes to ignore files, directories/folders, file permissions ... of the git repository ?

1 Ignore files And Folders using .gitignore Files (Include and/or Exclude)

Create the gitignore file at the top of your repository,i f it's not already exist
To Exclude A file/folder just add file path or the directory path like:

.htaccess
README.txt
backup
htdocs/temp
htdocs/sites/*/files
htdocs/sites/*/private

To re include a file / Folder already excluden before

!backup/file_to_include.txt
!htdocs/sites/all
!htdocs/sites/*/files/folder_to_include

2. Ignore File mode / file permissions (chmod/chown) using git config

(Examples are not tested)

git config core.fileMode false #For a specific repo
git config --global core.filemode false #For all of your repos

If this does not work you are probably using a newer version of git so try the --add option.
git config --add --global core.filemode false

If you run it without the --global option and your working directory is not a repo, you'll get
error: could not lock config file .git/config: No such file or directory

If this does not work, you can also do it manually:
1. Go to the .git Folder of your repository (cd path_to/your_project_repo/.git)
2. Edit the config File (vim config)
3. Change filemode = true to filemode = false And Save
[core]
        repositoryformatversion = 0
        filemode = false

4. Reinit the git (git init)

Add new comment