Git -bash:hooks/post-receive:权限被拒绝
我正在使用Git设置EC2 我走到这一步Git -bash:hooks/post-receive:权限被拒绝,git,bash,amazon-ec2,Git,Bash,Amazon Ec2,我正在使用Git设置EC2 我走到这一步 mkdir /var/www/www.example.org cat > hooks/post-receive #!/bin/sh GIT_WORK_TREE=/var/www/www.example.org git checkout -f chmod +x hooks/post-receive 但是,当我输入“cat>hooks/post-receive”或“sudo cat>hooks/post-receive”时,我会得到以下错误
mkdir /var/www/www.example.org
cat > hooks/post-receive
#!/bin/sh
GIT_WORK_TREE=/var/www/www.example.org git checkout -f
chmod +x hooks/post-receive
但是,当我输入“cat>hooks/post-receive”或“sudo cat>hooks/post-receive”时,我会得到以下错误:-bash:hooks/post-receive:权限被拒绝
我已经用我的git帐户设置了SSH密钥,所以一切都设置好了。我该怎么做才能继续前进。在创建工作树之前,我无法从这一步继续
sudo cat>hooks/post receive
仅以root用户身份运行cat
重定向(和文件创建)以当前用户身份进行
要在sudo上下文中进行重定向,需要在sudo shell下以脚本的形式运行整个过程
sudo bash -c 'cat > hooks/post-receive'
.git
目录、.git/hooks
目录和.git/hooks/post-receive
文件上的权限是什么?不确定,我怎么知道呢?ls-ld.git.git/hooks.git/hooks/post-receive
就是这样出现的