Home >Backend Development >PHP Tutorial >After using git to get the code, the owner and group have changed. Is there any solution?

After using git to get the code, the owner and group have changed. Is there any solution?

WBOY
WBOYOriginal
2016-08-04 09:20:341254browse

Now I use the root account to update the code. Before, the owner and group of the kernel.php file were www. Now after the update, it becomes root. Is there any way not to change it?
As shown:
After using git to get the code, the owner and group have changed. Is there any solution?

Reply content:

Now I use the root account to update the code. Before, the owner and group of the kernel.php file were www. Now after the update, it becomes root. Is there any way not to change it?
As shown:
After using git to get the code, the owner and group have changed. Is there any solution?

The easiest way is to switch to the www user and then pull the code, or use chown -R www:www . to re-update the owner after pulling the code.

Just use the aliasalias that comes with Linux to map it.

<code class="bash">alias wwwgit='su - www -c git' </code>

Then use wwwgit instead of git in future commands.


This is an idea, not tested

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn