移动远程分支 [英] Moving remote branch

查看:127
本文介绍了移动远程分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

重写提交树以重新命名作者和更改电子邮件,我的本地回购和远程来源不同步。我是唯一的开发者,并且希望将我的本地仓库推到原点,将origin / master更新到我的本地主分支。以下是我所尝试过的没有任何成功的:

  LibGuest08 @ LBP-NW0345QZMH1 / e / devel / src / java / bbct .0.5.2)
$ git push
密码:
至ssh://codeguru@git.code.sf.net/p/bbct/code
! [被拒绝] master - >主(非快进)
错误:未能将某些参考推送到'ssh://codeguru@git.code.sf.net/p/bbct/code'
提示:更新被拒绝因为推送的分支尖端位于其远程
提示:副本之后。如果您不打算推送该分支,您可能想要
提示:指定分支来推送或设置'push.default'配置
hint:variable以'current'或'upstream'推送只有当前分支。

LibGuest08 @ LBP-NW0345QZMH1 / e / devel / src / java / bbct(swing.0.5.2)
$ git push origin master:master
密码:
到ssh://codeguru@git.code.sf.net/p/bbct/code
! [被拒绝] master - >主(非快进)
错误:未能将某些参考推送到'ssh://codeguru@git.code.sf.net/p/bbct/code'
提示:更新被拒绝因为推送的分支尖端位于其远程
提示:副本之后。在再次推送之前,检查此分支并合并远程更改
提示:(例如'git pull')。
提示:有关详细信息,请参阅'git push --help'中的'关于快速转发的注意事项'。

LibGuest08 @ LBP-NW0345QZMH1 / e / devel / src / java / bbct(swing.0.5.2)
$ git push -f原点大师:master
密码:
计数对象:464,完成。
使用多达2个线程的增量压缩。
压缩对象:100%(148/148),完成。
写作对象:100%(452/452),470.65 KiB,完成。
总计452(delta 268),重用417(delta 247)
remote:错误:拒绝非快进refs / heads / master(你应该先拉)
to ssh:/ /codeguru@git.code.sf.net/p/bbct/code
! [remote rejected] master - > master(非快速转发)
错误:未能将某些文件推送到'ssh://codeguru@git.code.sf.net/p/bbct/code'

LibGuest08 @ LBP-NW0345QZMH1 / e / devel / src / java / bbct(swing.0.5.2)
$

我也按照建议拉起了原点,但是它会与所有提交进行合并,其中一些提交了错误的作者姓名和电子邮件。如何将我的远程原始库与我的本地库同步并删除所有提交的元数据错误?



更新:



我编辑了Sourceforge回购协议中的配置文件。我仍然收到一条错误消息,但我注意到了另一条线:

  lib_lab_ref08 @ LBP-REF87XVMDP1 / e / devel / src / java / bbct(master)
$ git push -f
密码:
计数对象:464,完成。
使用多达2个线程的增量压缩。
压缩对象:100%(148/148),完成。
写作对象:100%(452/452),470.65 KiB,完成。
共计452(delta 268),重用417(delta 247)
致命:无法创建临时文件:权限被拒绝
错误:解压缩失败:索引包异常退出
ssh://codeguru@git.code.sf.net/p/bbct/code
! [remote rejected] master - > master(n / a(unpacker error))
错误:未能将某些参考推送到'ssh://codeguru@git.code.sf.net/p/bbct/code'

是什么

 致命:无法创建临时文件:Permission denied 
error:unpack failed:index-pack abnormal exit

是什么意思?更重要的是,我该如何解决这个问题?



经过考虑:

我正在使用公共计算机。我最近压缩了我的repo数据库,并且我猜测我没有权限写入临时文件夹,git在推送过程中解压缩压缩的repo对象。我会在没有这些安全限制的计算机上试用此功能,并查看会发生什么情况。

解决方案

远程存储库上有一项设置, (这是一件好事)非快速推送,这就是你正在进行的推送类型。

当你指出你可以安全地做非ff推送,因为您是唯一一个使用它的人,所以请参阅这篇博客文章,以了解如何改变它:
$ b

  • 用<$ c $登录到ssh shell c> ssh -t USER,PROJECT @shell.sourceforge.net create

  • 导航到git仓库:cd到 / home / git / p /< project_name> /code.git (填写正确的项目名称) 使用编辑配置文件并将 denyNonFastforwards 设为 false


  • After rewriting the commit tree to rename the author and change the email, my local repo and remote origin are out of sync. I am the only developer and want to push my local repo to origin, updating origin/master to my local master branch. Here's what I have tried without any success:

    LibGuest08@LBP-NW0345QZMH1 /e/devel/src/java/bbct (swing.0.5.2)
    $ git push
    Password:
    To ssh://codeguru@git.code.sf.net/p/bbct/code
     ! [rejected]        master -> master (non-fast-forward)
    error: failed to push some refs to 'ssh://codeguru@git.code.sf.net/p/bbct/code'
    hint: Updates were rejected because a pushed branch tip is behind its remote
    hint: counterpart. If you did not intend to push that branch, you may want to
    hint: specify branches to push or set the 'push.default' configuration
    hint: variable to 'current' or 'upstream' to push only the current branch.
    
    LibGuest08@LBP-NW0345QZMH1 /e/devel/src/java/bbct (swing.0.5.2)
    $ git push origin master:master
    Password:
    To ssh://codeguru@git.code.sf.net/p/bbct/code
     ! [rejected]        master -> master (non-fast-forward)
    error: failed to push some refs to 'ssh://codeguru@git.code.sf.net/p/bbct/code'
    hint: Updates were rejected because a pushed branch tip is behind its remote
    hint: counterpart. Check out this branch and merge the remote changes
    hint: (e.g. 'git pull') before pushing again.
    hint: See the 'Note about fast-forwards' in 'git push --help' for details.
    
    LibGuest08@LBP-NW0345QZMH1 /e/devel/src/java/bbct (swing.0.5.2)
    $ git push -f origin master:master
    Password:
    Counting objects: 464, done.
    Delta compression using up to 2 threads.
    Compressing objects: 100% (148/148), done.
    Writing objects: 100% (452/452), 470.65 KiB, done.
    Total 452 (delta 268), reused 417 (delta 247)
    remote: error: denying non-fast-forward refs/heads/master (you should pull first)
    To ssh://codeguru@git.code.sf.net/p/bbct/code
     ! [remote rejected] master -> master (non-fast-forward)
    error: failed to push some refs to 'ssh://codeguru@git.code.sf.net/p/bbct/code'
    
    LibGuest08@LBP-NW0345QZMH1 /e/devel/src/java/bbct (swing.0.5.2)
    $
    

    I also pulled origin as suggested, but that does a merge with all the commits, some of which have the wrong author name and email. How do I sync my remote origin repo with my local repo and prune out all the commits with bad meta-data?

    Update:

    I edited the config file in the Sourceforge repo. I am still getting an error message, but I noticed a different line:

    lib_lab_ref08@LBP-REF87XVMDP1 /e/devel/src/java/bbct (master)
    $ git push -f
    Password:
    Counting objects: 464, done.
    Delta compression using up to 2 threads.
    Compressing objects: 100% (148/148), done.
    Writing objects: 100% (452/452), 470.65 KiB, done.
    Total 452 (delta 268), reused 417 (delta 247)
    fatal: Unable to create temporary file: Permission denied
    error: unpack failed: index-pack abnormal exit
    To ssh://codeguru@git.code.sf.net/p/bbct/code
     ! [remote rejected] master -> master (n/a (unpacker error))
    error: failed to push some refs to 'ssh://codeguru@git.code.sf.net/p/bbct/code'
    

    What does

    fatal: Unable to create temporary file: Permission denied
    error: unpack failed: index-pack abnormal exit
    

    mean? More importantly what do I do to fix this?

    After thought:

    I am using a public computer. I recently compressed my repo database and I am guessing that I don't have permission to write to the temporary folder where git is unpacking the compressed repo objects during the push. I will try this on a computer without these security restrictions and see what happens.

    解决方案

    There's a setting on the remote repository that prevents (and it's a good thing) non-fast-forward pushes, that is the type of push you're doing.

    As you point out you're safe to do non-ff push because you're the only one to work with it, so see this blog post to see how to change it:

    1. log into ssh shell with ssh -t USER,PROJECT@shell.sourceforge.net create
    2. navigate to the git repo: cd to /home/git/p/<project_name>/code.git (filling in the correct project name)
    3. edit the config file with vi and set denyNonFastforwards to false

    这篇关于移动远程分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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