【发布时间】:2018-09-08 23:13:37
【问题描述】:
当我在 Windows 中执行命令 git checkout -b /dev/myfeature 时,git bash 返回此错误:
fatal: 'C:/Program Files/Git/dev/myfeature' is not a valid branch name.
我做错了什么?
【问题讨论】:
标签: git git-for-windows
当我在 Windows 中执行命令 git checkout -b /dev/myfeature 时,git bash 返回此错误:
fatal: 'C:/Program Files/Git/dev/myfeature' is not a valid branch name.
我做错了什么?
【问题讨论】:
标签: git git-for-windows
来自https://git-scm.com/docs/git-branch
要创建或删除的分支的名称。新的 分支名称必须通过 git-check-ref-format[1] 定义的所有检查。 其中一些检查可能会限制分支中允许的字符 名字。
来自https://git-scm.com/docs/git-check-ref-format:
它们不能以斜线开头或结尾/或包含多个 连续的斜杠(请参阅下面的 --normalize 选项以了解例外情况 这条规则)
希望对你有帮助
【讨论】:
我在这里不是 100% 确定,但我怀疑前面的“/” 这类似于这个问题 Which characters are illegal within a branch name?
列表中有一个尾随“/”...所以我怀疑前导斜杠
【讨论】: