git错误“无法锁定配置文件。git/config权限被拒绝”

git错误“无法锁定配置文件。git/config权限被拒绝”,git,amazon-ec2,Git,Amazon Ec2,我正在AWSEC2上开发,并安装了git flow。 我命令 git flow init 然后,错误发生了 Which branch should be used for bringing forth production releases? - master Branch name for production releases: [master] master error: could not lock config file .git/config: permission deni

我正在AWSEC2上开发,并安装了git flow。 我命令

git flow init
然后,错误发生了

Which branch should be used for bringing forth production releases?
   - master
Branch name for production releases: [master] master
error: could not lock config file .git/config: permission denied
Branch name for "next release" development: [develop] 
error: could not lock config file .git/config: permission denied
fatal: Unable to create '/var/www/html/dev1/tomato/.git/index.lock': permission denied

How to name your supporting branch prefixes?
Feature branches? [feature/] 
error: could not lock config file .git/config: permission denied
Release branches? [release/] 
error: could not lock config file .git/config: permission denied
Hotfix branches? [hotfix/] 
error: could not lock config file .git/config: permission denied
Support branches? [support/] 
error: could not lock config file .git/config: permission denied
Version tag prefix? [] 
error: could not lock config file .git/config: permission denied

为什么我无法成功访问git flow init???

检查是否定义了%HOME%环境变量

如果该变量存在并引用H:\而不是%USERPROFILE%,那么它将在H:.gitconfig中查找全局git配置文件,意思是%HOME%.gitconfig


将%HOME%变量更改为像%USERPROFILE%这样的本地路径可以解决这个问题。

我尝试过,但如果使用sudo,就无法使用git flow命令。你知道为什么如果我是root用户就不能使用git flow命令吗?也许可以试试:sudo chmod 777.git/config,它是.git文件夹所在的位置。我试过了,但还是做不到。除此之外,我注意到我无法命令git branch xxxx将新分支设置为ec2 usernormal用户。如果运行ls-al.git,是否有任何异常情况?您显然没有对配置文件的写入权限。