Skip to main content
Drupal 8

Main navigation

  • Home
    • Question And Answer
    • NEWS
    • Projects
  • Tutorials - Drupal
    • Android
    • Other
User account menu
  • Log in

Breadcrumb

  1. Home

Git - Ignore Files, Directories, Permissions

By editor , 10 June, 2016
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)

Tags

  • Shell
  • Server
  • Git
Helpful git commands
Make Correction on a git
Create and Apply Patches using GIT DIFF and APPLY
Install GitLab Community Edition

Comments

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.

Links

  • Drupal.org
  • Drupal core release cycle
  • Drupal events with ease
  • Unit test with Drupal using PHPUnit (Drupal 10)
  • Tokens for file upload url
  • Tips for Docker
  • CKEditor inline image files usage for custom forms.
  • Install Docker on Linux Mint
  • Install PHP 8.1
  • Drupal Security Best Practices
  • Order and sort items with tabledrag
  • Add a custom service YAML container
  • Apply a patch with composer