如何更改GitHub上的文件模式? [英] How to change the File Mode on GitHub?

查看:352
本文介绍了如何更改GitHub上的文件模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  $ git add测试文件

$ git commit -m'第一次提交'
创建模式100644测试文件

$ git push






  $ git update-index --add --chmod = + x测试文件

$ git commit -m'更改模式'
模式更改100644 => 100755测试文件

$ git push






之后,如果你去GitHub,它仍然显示为100644,无论如何。

解决方案

MSYS不是问题。即使MSYS chmod 不起作用(它没有),Git内置了解决这个问题的方法,即 git update-index --chmod = + X 。请说清楚, git update-index 仅与索引(暂存区域)混淆,而不是本地存储库(工作目录)。



我确信问题出在GitHub上。在GitHub上,如果文件最初使用模式100775推送,则一切正常。如果一个文件最初推送为100644,则会导致问题。尝试更改文件模式将以 git add 成功,并以 git commit 成功,并以 git push ,甚至显示在GitHub文件历史记录中,但 not 会反映在GitHub上的blob / master页面中。



更新


来自:Petros Amiridis(GitHub员工)

主题:如何更改GitHub上的文件模式?



我有一些好消息。我们真棒团队刚刚证实,它是我们结束时的缓存错误
。我们的团队已经部署了修复程序。



$ git add test-file

$ git commit -m 'first commit'
 create mode 100644 test-file

$ git push


$ git update-index --add --chmod=+x test-file

$ git commit -m 'change mode'
 mode change 100644 => 100755 test-file

$ git push


After that if you go to GitHub it still shows as 100644 no matter what.

解决方案

MSYS is not the problem. Even if MSYS chmod doesnt work (it doesnt), Git has a built in way of getting around that problem, ie git update-index --chmod=+x. Let it be clear that git update-index only messes with the index (staging area), not the local repository (working directory).

I am convinced the problem is with GitHub. On GitHub if a file is initially pushed with mode 100775, all is well. If a file is initially pushed as 100644 it causes a problem. Attempts to change the file mode will succeed with git add, succeed with git commit, succeed with git push, and even show up in the GitHub file history, but not be reflected on the "blob/master" page on GitHub.

Update

From: Petros Amiridis (GitHub Staff)

Subject: How to change FIle Mode on GitHub?

I have some good news. Our awesome team has just confirmed it is a caching bug on our end. Our team has deployed a fix.

这篇关于如何更改GitHub上的文件模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆