在创建用户之前,我已经将git作为root安装在我的Linux (debian)系统上。在创建用户之后,我尝试运行命令(作为新用户):
git config --global user.name "myusername" 但我知道错误是:
error: could not lock config file /home/<username>/.gitconfig: Permission denied当我打字时
git config --global --edit它用path /home/<username>/.gitconfig启动我的编辑器。我觉得这真的很奇怪。我尝试创建.gitconfig文件,将其创建为sudo,然后将.gitconfig文件从/root/.gitconfig移动到/home/<username>/.gitconfig,最后将chown移动到我的用户,但这也不起作用。请帮帮我..。
编辑:这个问题与用户对主目录的用户权限有关。我刚跑了:
sudo chown username:username /home/username然后它起了作用。
发布于 2013-07-28 13:27:47
在你变得近乎疯狂之前,只需在.gitconfig中手工编辑/插入用户名?使用您选择的编辑器打开它,然后继续:
gitconfig摘录自我:
[user]
name = myusername
email = mymailaddress@mymailprovider.tld
[color]
branch = on
diff = on
interactive = on
status = on
...命令行中的user.name是配置中的[user] + name =组合。
name只是缩进了一个选项卡。
发布于 2013-07-28 14:13:02
安装git
vagrant@precise32:~$ sudo apt-get install git提高用户的....Set
vagrant@precise32:/$ sudo useradd -m yourusername
vagrant@precise32:/$ sudo passwd yourusername
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
vagrant@precise32:/$ su - yourusername
Password:
$ ls
$ pwd
/home/yourusername...Configure git
$ git config --global user.name "yourusername"
$ ls -a
. .. .bash_logout .bashrc .gitconfig .profile
$ cat .gitconfig
[user]
name = yourusername发布于 2013-07-28 14:17:04
如果这个对你有用的话,试试这个
mkdir ~/.git
git config --global user.name= <name>https://stackoverflow.com/questions/17908386
复制相似问题