移动远程分支

Cod*_*ice 4 git version-control

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

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)
$
Run Code Online (Sandbox Code Playgroud)

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

更新:

我在Sourceforge repo中编辑了配置文件.我仍然收到错误消息,但我注意到另一行:

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'
Run Code Online (Sandbox Code Playgroud)

是什么

fatal: Unable to create temporary file: Permission denied
error: unpack failed: index-pack abnormal exit
Run Code Online (Sandbox Code Playgroud)

意思?更重要的是我该怎么做才能解决这个问题?

经过思考:

我正在使用公共电脑.我最近压缩了我的repo数据库,我猜我没有权限写入临时文件夹,其中git在推送期间解压缩压缩的repo对象.我会在没有这些安全限制的计算机上尝试这个,看看会发生什么.

Cha*_*esB 6

远程存储库上有一个设置可以阻止(并且这是一件好事)非快进推送,这就是您正在进行的推送类型.

正如你所指出的那样,你可以安全地进行非ff推送,因为你是唯一一个使用它的人,所以请看这篇博客文章,了解如何更改它:

  1. 用.登录到ssh shell ssh -t USER,PROJECT@shell.sourceforge.net create
  2. 导航到git repo:cd to /home/git/p/<project_name>/code.git(填写正确的项目名称)
  3. 与编辑配置文件vi,并设置denyNonFastforwardsfalse