2

I use git to pull changes os a site's code base. The changes inside files and deletion of files works, however, when I add new files or directories (not empty ones) to the repo, it wont get pulled locally to the webserver, when pulling no error message is displayed but when checking for that file, it is not there. Online at the bitbucket repo it is shown.

Tried to delete the local git repo and clone it again, this way I get all the files from origin, but the problem persist when doing a pull for newly added file. It shows as if its pulled:

...
   18bb8ac..c9c1e40  master     -> origin/master
Updating 18bb8ac..c9c1e40
Fast-forward
 config/plugins/test1.txt   | 22 ++++++++++++++++++++++
 config/plugins/testing.txt | 22 ++++++++++++++++++++++
 2 files changed, 44 insertions(+)
 create mode 100644 config/plugins/test1.txt
 create mode 100644 config/plugins/testing.txt

But when checking (ls -la config/plugins/), the new files are not there. Even if I try the pull with sudo git pull.

I tried hard but after this I couldn't make the file appear unless I removed the whole local repo and cloned it again. No hard reset, nothing seems to help.

What I did check:

  • Ensured there are actually saved changes on the file in question.
  • Ensured the file doesn't meet my exclude rules in .gitignore and .git/info/exclude
  • Ensured not trying to add an empty folder. Git won't track those.

My permission settings for this repo on the webserver was based on: https://www.agix.com.au/git-a-walk-through-for-sysadmins/

So it is:

sudo chown apache:apache -R /var/www/html/sites/mysite
cd /var/www/html/sites/mysite
# File permissions, recursive
sudo find . -type f -exec chmod 0644 {} \;
# Dir permissions, recursive
sudo find . -type d -exec chmod 0755 {} \;
sudo setfacl -R -b -m user:root:rwx -m d:user:root:rwx -m group:developers:rwx -m d:group:developers:rwx -m group:apache:rx -m d:user:apache:rx /var/www/html/sites/mysite

My user in the developer's group.

Here is my .git directory from the server.

I'm using CentOS7 and git 2.16.3.

obeliksz
  • 468
  • 9
  • 24

1 Answers1

1

Pulling files to other repos on the same server worked so I deleted this problematic repo's remote repository completely and the local .git directory and created a new remote repo and added to it the existing files. Only this have solved the issue.

Hopefully next time if the problem rises again I can update this answer with more clues as to what I did with the repo that made it to go nuts.

obeliksz
  • 468
  • 9
  • 24