I had difficulties with git and netbins.

Here is the course of my actions:

On hosting:

  1. Creating a repository in the existing git init directory
  2. Adding all git add ... files and folders git add ...
  3. First commit git commit -m 'initial project version'

By local machine:

  1. I clone the repository on ssh: sudo git clone ssh://user @host /path/to/project/ /local/path/to/project

  2. I create a project with existing code in Netbeans. Everything is created, Netbeans pulls up git, master appears on the project name.

  3. But all files in Netbeans are read-only. I solved this problem only by passing all 777 permissions to the files with the command sudo find /local/path/to/project -type f -exec chmod 777 {} +

Is it normal that all project files on the local machine now have 777 permissions? If not, how to fix it?

PS put all 775 rights, Netbeans could no longer edit files.

  • one
    Well, you did sudo git clone, so this is quite expected. Make a git clone without sudo and everything should be fine. - Costantino Rupert
  • @ Kotik_hochet_kusat without sudo swears "Access denied." - Demyan112rv
  • one
    @ Demyan112rv - Yes, since you, with your team, tried to clone the repository into the /local folder (in the root!), Which, naturally, cannot be done without having superuser privileges. That is, roughly speaking, the system tried to warn you that you are most likely trying to do something wrong, but you plugged it in by typing sudo :) - Try git clone REPOSITORY_URL /usr/local/path/to/project . - Costantino Rupert
  • @ Kotik_hochet_kushat I conditionally wrote the path / local ... I have projects in the folder / var / www / I don’t know if this is bad or good. But without sudo, I can't do anything in this folder - Demyan112rv
  • one
    @ Demyan112rv are you on the machine where you will develop clones or will you do a local deployment? From / var / www, it is customary for the www-data user to distribute sites, and it is customary to develop in / home / <username> / [source | src | projects | etc] as their user. - pirj

1 answer 1

  • If I understand correctly, the location of the project in /var/www dictated by the fact that you have some kind of a la Apache service, for which Document /var/www is used as the DocumentRoot.

In this case, you want to combine the ability to edit the project in NetBeans so that the Apache-like thing immediately picks up the changes for any operations in the git repository.

  • You have several options for solving this problem:

  • (1) Make a group (conditionally, people-who-can-touch-var-www ), add the apache user and your current user to it, and then make the appropriate chown / chmod for /var/www .

See the first answer on the link.

  • (2) In the web server you use, set up some virtualhost analog for the project folder in $HOME . I personally find this option preferable, since you can simply edit the project located in your home directory, without having to touch the rights for /var/www/ .

See the third answer on the link.