Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
当父repo使用这个新的git版本2.13在“development”分支上时,如何执行“git push--recurse submodules=on-demand”?_Git_Git Submodules_Git Push - Fatal编程技术网

当父repo使用这个新的git版本2.13在“development”分支上时,如何执行“git push--recurse submodules=on-demand”?

当父repo使用这个新的git版本2.13在“development”分支上时,如何执行“git push--recurse submodules=on-demand”?,git,git-submodules,git-push,Git,Git Submodules,Git Push,有关: 在git 2.13版之前,这里的一切都很完美,但现在这个版本打破了我的工作流程: Push: process for submodule 'Packages/Advanced CSV' failed D:\SublimeText\Data> git.exe push --porcelain --progress --tags --recurse-submodules=on-demand origin refs/heads/develop:refs/heads/develo

有关:

  • git 2.13版之前,这里的一切都很完美,但现在这个版本打破了我的工作流程:

    Push: process for submodule 'Packages/Advanced CSV' failed
        D:\SublimeText\Data> git.exe push --porcelain --progress --tags --recurse-submodules=on-demand origin refs/heads/develop:refs/heads/develop
        src refspec 'refs/heads/develop' must name a ref
        process for submodule 'Packages/Advanced CSV' failed
    
    我正在使用
    Smartgit
    客户端,现在当我按下按钮时,我发现上面的错误。搜索时,我发现这是git客户端上的一个新更新问题:

  • 看起来git push递归子模块的行为已经改变。 目前使用2.13,您无法运行“git push” --递归子模块=按需“如果父回购位于不同的 分支机构,而非次级回购,例如,母公司回购处于“开发”状态,且 关于“主”的次级回购协议

    我的印象是乔纳森和其他人可能会被考虑 事实上,
    gitpush--recurse submodules=on-demand
    不起作用 像以前一样,无意的改变。他之前问过我 如果没有refspec,它将对我们起作用,我的回答是肯定的。这个 问题仍然存在,如果每个人都在推动变革,而不是 refspec在父回购协议中使用
    push.default
    ,以及 子模块

    干杯

    JS

    我不理解最后一部分
    ,没有refspec在父回购协议和子模块中使用push.default,当父回购协议在
    develope
    分支上,子模块在
    master
    分支上时,这是一种
    git push--recurse submodules=on-demand
    的方法吗

    如果不是,当父回购位于
    develope
    分支上,但子模块位于
    master
    分支上且具有此新git版本时,我如何执行
    git push--recurse submodules=on-demand


    更新 我创建了这个脚本,它在本地用本地遥控器再现了这个问题:

    # Create the directory structure
    rm -r -f main_repo
    rm -r -f main_repo_remote
    rm -r -f submodule_remote
    
    mkdir main_repo_remote
    mkdir submodule_remote
    mkdir main_repo
    mkdir main_repo/first_submodule
    
    cd main_repo
    
    # Setup the first_submodule
    cd first_submodule
    printf "# Submodule Repository\n\n" > README.md
    git init
    git add README.md
    git commit -m "Added the repository first commit."
    
    git init --bare ../../submodule_remote
    git remote add origin ../../submodule_remote
    git push origin master
    
    # Setup the main_repo
    cd ..
    printf "# Main Repo\n\nThis is the main repository which contains submodules\n" > README.md
    git init
    git add README.md
    git submodule add -- ../../submodule_remote "first_submodule"
    git commit -m "Added the main repository first commit."
    
    git init --bare ../main_repo_remote
    git remote add origin ../main_repo_remote
    git push origin master
    git checkout -b develop
    git push --set-upstream origin develop
    
    # Add an unpushed commit to the submodule
    cd first_submodule
    printf "Dirty\n\n" >> README.md
    git add README.md
    git commit -m "Added the repository second commit."
    
    # Go to the main repository and do the push
    cd ..
    git add first_submodule
    git commit -m "Added the main repository second commit."
    git push --recurse-submodules=on-demand
    
    在它的最后一行,我正在推动主回购协议,但在新的git版本上失败了。 目前的解决方案是手动打开需要推送的子模块,并在推送主存储库之前推送它们,因为选项
    --recurse submodules=on-demand
    在主存储库上不起作用

    这是一个输出示例:

    $ sh create_bug.sh
    Initialized empty Git repository in D:/User/Downloads/test/main_repo/first_submodule/.git/
    [master (root-commit) 69015bb] Added the repository first commit.
     1 file changed, 2 insertions(+)
     create mode 100644 README.md
    Initialized empty Git repository in D:/User/Downloads/test/submodule_remote/
    Counting objects: 3, done.
    Writing objects: 100% (3/3), 249 bytes | 0 bytes/s, done.
    Total 3 (delta 0), reused 0 (delta 0)
    To ../../submodule_remote
     * [new branch]      master -> master
    Initialized empty Git repository in D:/User/Downloads/test/main_repo/.git/
    Adding existing repo at 'first_submodule' to the index
    [master (root-commit) 6af0279] Added the main repository first commit.
     3 files changed, 7 insertions(+)
     create mode 100644 .gitmodules
     create mode 100644 README.md
     create mode 160000 first_submodule
    Initialized empty Git repository in D:/User/Downloads/test/main_repo_remote/
    Counting objects: 4, done.
    Delta compression using up to 4 threads.
    Compressing objects: 100% (4/4), done.
    Writing objects: 100% (4/4), 430 bytes | 0 bytes/s, done.
    Total 4 (delta 0), reused 0 (delta 0)
    To ../main_repo_remote
     * [new branch]      master -> master
    Switched to a new branch 'develop'
    Total 0 (delta 0), reused 0 (delta 0)
    To ../main_repo_remote
     * [new branch]      develop -> develop
    [master 58e7111] Added the repository second commit.
     1 file changed, 2 insertions(+)
    [develop 69f9588] Added the main repository second commit.
     1 file changed, 1 insertion(+), 1 deletion(-)
    fatal: src refspec 'develop' must name a ref
    fatal: process for submodule 'first_submodule' failed
    fatal: The remote end hung up unexpectedly
    

    我用最新的2.14.x(我看过之后编译的)试用了你的脚本。它仍然不起作用。如果我使用push-u源主机,并且如果子模块签出了最初讨论过的同一个主分支(而不是dev),并在上发送到git邮件收件箱,但在几个月内,git维护人员都忽略了这一点,这是非常糟糕的。或者它被认为是“按预期工作”?很难说。与git团队的沟通太差了。我自己无法将电子邮件发送到git邮件列表。他们说我的电子邮件帐户不可信。后来有人寄给我,但从那以后就没人回复了。也许他们应该使用问题跟踪器作为GitHub的跟踪器,而不是难以访问的邮件列表。不管怎么说,总有一天我会得到源代码,自己构建自己的版本来解决这个问题