简体   繁体   中英

git: recovering server/remote repository from backup

today i lost my remote repository due to a server crash. i installed a backup which was 2-3 hours old. unfortunately i made some pushed after the backup creation and now the master branch of my local is "out of sync" compared to the remote master branch. my local master is a couple of commits/pushed ahead of the remote master and now i do not know what to do. i can not push again, it says "! [remote rejected] master -> master (n/a (unpacker error))". pulling does not help either. is there a way to get them back "in sync" cleanly?

otherwise i would diff the two masters, clone the remote again and apply the patches and commit again. the biggest problem with that is that all my other developers need to do the same (because their master branches are out of sync as well) and we have a lot of unpushed local feature branches laying around.

any nice solution? if not i have to rethink my backup process as well :)

regards, stefan

The "(unpacker error)" you get may indicate that your remote simply isn't working properly. If it were working properly, I would expect you to be able to push your local repo to the remote successfully.

Does pushing for another unrelated remote repository work? If you get the same error, it's probably a configuration problem on the remote machine, not anything to do with that specific repo.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM