4

重写提交树以重命名作者并更改电子邮件后,我的本地仓库和远程源不同步。我是唯一的开发人员,并且想将我的本地 repo 推送到 origin,将 origin/master 更新到我的本地 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)
$

我还按照建议提取了来源,但这会与所有提交合并,其中一些提交的作者姓名和电子邮件地址错误。如何将远程原始存储库与本地存储库同步并删除所有包含错误元数据的提交?

更新:

我在 Sourceforge 存储库中编辑了配置文件。我仍然收到一条错误消息,但我注意到另一行:

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'

做什么

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

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

想了想:

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

4

1 回答 1

6

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

正如您指出的那样,您可以安全地进行非 ff 推送,因为您是唯一使用它的人,因此请参阅此博客文章以了解如何更改它:

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