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

时间:2015-09-30 12:30:53

标签: git amazon-ec2

我正在开发aws ec2,并安装了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 ??

1 个答案:

答案 0 :(得分:0)

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

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

将%HOME%变量更改为%USERPROFILE%等本地路径可以解决该问题。