Error while using Git on Ubuntu

Asked

Viewed 138 times

2

So, I am currently using the Ubuntu 15.04 operating system to develop my daily activities. I have a PHP web project where I use the Cakephp 3 Framework and version my project in Bitbucket.

My problem is this, when I clone my project directly from Bitbucket to make it accessible locally and run the command $ sudo composer install in the directory where my project is located for it to install environment variables, my project is inaccessible on the web due to lack of permissions in some directories located inside its folder [Error presented by Cakephp stating that it is not possible to access some files due to lack of permission]. By granting read and write permissions to my project folder and accessing it again via the web, some pages are not redirected correctly [Cakephp error reporting that Controller "X" was not found], however I have not changed anything but permissions.

When executing the command $ git status in the directory of my project I realize that there are numerous modifications in classes and configuration files of the same, and I didn’t change anything.

TESTS CARRIED OUT:

  • Clone project, execute command $ git status => is not modified.
  • Clone project, execute command $ sudo composer install and then after executing the command $ git status => is not modified.
  • Clone project, execute command $ sudo composer install and then after executing the command $ git status, grant permissions to the project directory => displays numerous modifications.
  • Clone project, grant permissions to the project directory and run the command $ git status => has numerous modifications.

How to proceed with this situation?

  • Managed to solve your problem?

  • Do not clone or run Poser install using sudo. The chance of permission problems is quite large.

1 answer

1

Use the same user as the owner of the directory. Use sudo composer install causes root to be used. Use only composer install. If the user can’t write to the target directory, try adding it to the same group as the owner with the command usermod -a -G <nome grupo> <nome usuario>

Or

Run all commands using root - [Not recommended]

  • I very much believe that the problem is not the commiserate, because even executing the command composer install and granting root permissions to the project folder, the problem persists. It appears in my Stage numerous files, which if you want have been changed. That is, the issue with versioning occurs after granting privileges to the project folder. It doesn’t make much sense for me to change the permissions of a folder and for Git to interpret that its files have changed.

  • Do the following test (I did it here) [user] git status&#xA; nothing to commit (working directory clean)&#xA; [user] echo foo > bar&#xA; [user] git add bar; git commit -m "teste"&#xA; [user] git status&#xA; nothing to commit (working directory clean)&#xA; [user] chmod 777 bar&#xA; [user] git status&#xA; #(...)&#xA;# modified: bar Note that simply changing file permissions effectively changes the file. Permissions are marked directly in the file and therefore changing them will make git change. Use the same user to make it the git init until the completion of the Commission.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.