Ubuntu的git初始化权限被拒绝 [英] ubuntu git init permission denied

查看:247
本文介绍了Ubuntu的git初始化权限被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想我的权利有问题。

我安装了几乎全新的Ubuntu 14.04,并且只是配置了我的虚拟主机来显示我的小型html项目。
新网站在Firefox中正常工作没有问题。



但是现在我想初始化一个新的git仓库并且失败。

当我在/ var / www / html中输入时

  git init 

我得到这个错误

  / var / www / html / .git:permission denied 

我的/ var / www有这些权限:

  drwxrwxr-x 13 www-data www-data 4096 Jan 4 18:48 html / 

当我输入

  ssh-add -l 

我的id_rsa(RSA)显示正确。

我不知道我在这里错过了什么。 : - www-data 用户和 www-data 组的成员编写文件,您可以将自己添加到 www-data 使用以下命令组:

  usermod -a -G www -data your_username 

如果您通过SSH登录,则需要注销<然后再回来。



这应该允许您在该文件夹中编写文件,而不必为每个人提供写入权限。这样做对于制作不是一个好主意服务器。


I guess I have a problem with my rights.
I have a nearly new Ubuntu 14.04 installed and just configured my vhost to display my little html project. The new site has no problem to work correctly in the Firefox.

But now I want to initialize a new git repo and failed.
When I type inside /var/www/html

git init  

I get this error

/var/www/html/.git: permission denied 

My /var/www has these permissions:

drwxrwxr-x 13 www-data www-data 4096 Jan  4 18:48 html/ 

When I type

ssh-add -l  

my id_rsa(RSA) is displayed correctly.

I have no clue what else I missing here. :-(

解决方案

Your /var/www folder permissions only permit writing files for the www-data user and members of the www-data group. You can add yourself to the www-data group with the following command

usermod -a -G www-data your_username

If you're logged in over SSH you will need to logout and then back on.

That should allow you to write files in that folder without having to give everyone write permissions. Doing so is not a good idea on a production server.

这篇关于Ubuntu的git初始化权限被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆