git 分支名称的最大长度
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24014361/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Max length of git branch name
提问by MikDiet
I want to understand what is maximum allowed size of a git branch name.
我想了解 git 分支名称的最大允许大小是多少。
I am trying to create some long names (as an experiment) so a name with 370 characters was valid, but 380 characters gave me fatal: Failed to lock ref for update: File name too long
我正在尝试创建一些长名称(作为实验),因此 370 个字符的名称是有效的,但是 380 个字符给了我 fatal: Failed to lock ref for update: File name too long
So the questions is: what is the maximum number of characters that can be in git branch name? Does it depend on the system? Is it possible to create long branch name in a repository that will be rejected on remote repository (i.e. Github)?
所以问题是:git 分支名称中可以包含的最大字符数是多少?它取决于系统吗?是否可以在远程存储库(即 Github)上拒绝的存储库中创建长分支名称?
采纳答案by Wander Nauta
The 'File name too long' is indeed an error coming from your system. It is not a restriction in Git. I don't think there's a way of testing the maximum branch name lengths of other systems, like GitHub's, without experimenting - although I don't see why you would want to know...
“文件名太长”确实是来自您的系统的错误。这不是 Git 中的限制。我不认为有一种方法可以测试其他系统的最大分支名称长度,如 GitHub 的,而不进行实验——尽管我不明白你为什么想知道......
.
.
Source: the error mentioned is thrown on line 291 of branch.c
. "File name too long" is the standard description for the ENAMETOOLONG error.
来源:提到的错误是在第 291 行抛出的branch.c
。“文件名太长”是 ENAMETOOLONG 错误的标准描述。
回答by Issam Ressani
Open the Github Powershell, and execute the following command :
打开Github Powershell,执行如下命令:
git config --system core.longpaths true
git config --system core.longpaths true