Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/clojure/3.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
错误。git文件夹_Git_Bitbucket - Fatal编程技术网

错误。git文件夹

错误。git文件夹,git,bitbucket,Git,Bitbucket,我正在建立一个新的开发服务器,同时切断了一个前代理的访问权限。这包括建立一个新的回购协议并取消他们的回购协议。 因此,我使用rsync将文件从live服务器复制到dev服务器。然后我删除了.git文件夹,创建了一个新的repo,并将其设置为推送到那里。在此期间,对live server进行了一些更改,因此我决定再次rsync。我完全忘记了.git文件夹,我一意识到就取消了rsync,但为时已晚,它将一些.git从旧的repo复制到了创建的新repo。现在我得到了下面列出的错误 warning:

我正在建立一个新的开发服务器,同时切断了一个前代理的访问权限。这包括建立一个新的回购协议并取消他们的回购协议。 因此,我使用rsync将文件从live服务器复制到dev服务器。然后我删除了.git文件夹,创建了一个新的repo,并将其设置为推送到那里。在此期间,对live server进行了一些更改,因此我决定再次rsync。我完全忘记了.git文件夹,我一意识到就取消了rsync,但为时已晚,它将一些.git从旧的repo复制到了创建的新repo。现在我得到了下面列出的错误

warning: reflog of 'refs/remotes/origin/snagging-882' references pruned commits
warning: reflog of 'refs/remotes/origin/snagging-896' references pruned commits
warning: reflog of 'refs/remotes/origin/snagging-899' references pruned commits
warning: reflog of 'refs/remotes/origin/snagging-911' references pruned commits
warning: reflog of 'refs/remotes/origin/develop' references pruned commits
warning: reflog of 'refs/remotes/origin/staging' references pruned commits
warning: reflog of 'refs/remotes/origin/review' references pruned commits
error: Could not read c1fd5ccb43ddea672fa5b141a0fdb0d65d813b8a
fatal: Failed to traverse parents of commit 57c5f1c268a7775ebab6ee4f42d94dec2159844f
error: failed to run repack
我可以恢复我的.git文件夹吗?还是需要重新创建

感谢

假设您已将新的repo推送到远程,解决此问题的最安全方法是将新的repo克隆到新的本地目录中,并将其设置为使用已损坏
.git
目录的工作树

以下是一个分步指南:

1. git clone <url-to-new-repo> FreshNewRepo && cd FreshNewRepo
   # Clone the new repo into a new local directory called 'FreshNewRepo'

2. git --work-tree=/path/to/corrupted-repo add -A
   # Set up the 'FreshNewRepo' to use the working tree from the corrupted repo
   # (thereby getting the rsynced files from the old repo), then stage all changes

3. git status
   # At this point, you should have all the changes from corrupted repo
   # in the index of your 'FreshNewRepo'

4. git commit
   # Create a commit to mark that you imported the latest changes from the old repo.

5. (optional) rm -rf /path/to/corrupted-repo
   # Once you're certain that no changes are left behind in the corrupted repo,
   # (either commits not being pushed or uncommitted changes in the working tree)
   # there's no reason to keep it around.
1。git克隆FreshNewRepo和cd FreshNewRepo
#将新的repo克隆到名为“FreshNewRepo”的新本地目录中
2.git--工作树=/path/to/corrupted repo add-A
#设置“FreshNewRepo”以使用损坏的repo中的工作树
#(从而从旧repo获取rsynced文件),然后进行所有更改
3.git状态
#此时,您应该拥有来自损坏的repo的所有更改
#在您的“FreshNewRepo”索引中
4.git提交
#创建一个提交到标记,用于从旧回购中导入最新更改。
5.(可选)rm-射频/路径/到/损坏的回购
#一旦您确定损坏的回购协议中没有留下任何变化,
#(提交未被推送或未提交工作树中的更改)
#没有理由把它留着。
```


以下是关于该选项的一些信息。

在删除任何内容之前,您是否在新回购中有任何未推送到新远程服务器的提交?