我对这个git和github的东西很新,我正在将本地repo master分支的提交推送到远程github repo。推送工作成功,远程仓库相应更新,但在推送消息结束时,我得到了这个冗长的错误:
error: update_ref failed for ref 'refs/remotes/origin/master': cannot lock ref 'refs/remotes/origin/master': Unable to create '/Users/ahmedhassan/version-control/reflections/.git/refs/remotes/origin/master.lock': Permission denied
答案 0 :(得分:1)
在设置git存储库时,您可能会在某些时候不必要地使用sudo
。我建议再次从GitHub在新目录中使用sudo 克隆存储库。
git clone https://github.com/ahmedhassan/repository.git
答案 1 :(得分:1)
在某些时候,您在本地存储库(/Users/ahmedhassan/version-control/reflections/.git/
)中执行了某些操作(可能是root
,可能是sudo
。这改变了那里的一些文件,以便它们现在由其他用户拥有,而不是由你拥有。您无权修改其他用户的文件。
解决方案是将这些文件的所有权设置回给自己,以便您有权修改它们。
答案 2 :(得分:0)
首先你必须用git初始化你的文件夹。
使用:git init
命令。