git pull 如何忽略 Permission Denied 错误

30 views
Skip to first unread message

Bojie Li

unread,
Jul 19, 2014, 11:21:21 AM7/19/14
to USTC_LUG
有一个版本库属于 op 用户,其中一个子目录是 700,属于 www-data。我不小心往版本库的这个子目录里提交了一个文件,op 用户在 git pull 的时候就提示 error: cannot stat ...: Permission Denied
如果不允许在版本库里把这个文件删掉,有没有办法让 git pull 忽略 Permission Denied 错误?

Zhang Cheng

unread,
Jul 19, 2014, 12:01:16 PM7/19/14
to USTC LUG

2014-07-19 23:21 GMT+08:00 Bojie Li <boj...@gmail.com>:
有一个版本库属于 op 用户,其中一个子目录是 700,属于 www-data。我不小心往版本库的这个子目录里提交了一个文件,op 用户在 git pull 的时候就提示 error: cannot stat ...: Permission Denied
如果不允许在版本库里把这个文件删掉,有没有办法让 git pull 忽略 Permission Denied 错误?

​我不是很明白你描述的问题。

git pull == git fetch + git merge

而merge时,因为merge可能会产生冲突,需要手动解决,所以会需要使用到workspace。因此merge的过程是,首先确保当前工作目录在某一个branch的头上,然后将远程分支的内容在工作目录下合并,如果一切顺利,则产生新的commit,否则等待手动处理冲突之后手动commit。

现在猜测你的问题是,你的某个文件f,op用户无法读写,但是它存在于某个版本中,所以在merge时必须要读取(或修改)这个文件。这里我觉得时没有办法的,如果不能读写这个文件,那么就不能正常的merge了。​



--
Cheng,
Best Regards

Bojie Li

unread,
Jul 19, 2014, 12:34:54 PM7/19/14
to ustc...@googlegroups.com
是这个意思,就是要忽略 git merge 无法读写文件的错误,没有一个 force 的选项?
--
-- 来自USTC LUG
请使用gmail订阅,不要灌水。
更多信息more info:http://groups.google.com/group/ustc_lug?hl=en?hl=en

---
You received this message because you are subscribed to the Google Groups "USTC_LUG" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ustc_lug+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Zhang Cheng

unread,
Jul 19, 2014, 12:44:20 PM7/19/14
to USTC LUG

2014-07-20 0:34 GMT+08:00 Bojie Li <boj...@gmail.com>:
是这个意思,就是要忽略 git merge 无法读写文件的错误,没有一个 force 的选项?

​应该没有办法。如果用force的话,那么你期望的合并结果是什么呢?
在产生冲突时,可以用git checkout --ours/--theirs来选择直接使用某一边的内容。但是问题是commit是在本地工作目录产生的,如果本地的某一个文件不能读取,那就没办法产生commit了。​



--
Cheng,
Best Regards

SJ Zhu

unread,
Jul 19, 2014, 12:47:39 PM7/19/14
to USTCLUG-Group
不是很清楚下面的方法行不行:
把那个文件只加进本地gitignore

Zhang Cheng

unread,
Jul 19, 2014, 12:50:29 PM7/19/14
to USTC LUG

2014-07-20 0:47 GMT+08:00 SJ Zhu <zsj9...@gmail.com>:
不是很清楚下面的方法行不行:
把那个文件只加进本地gitignore

​没用,gitignore仅对untracked的文件有效。​



--
Cheng,
Best Regards
Reply all
Reply to author
Forward
0 new messages