我有一个heroku应用程序。我克隆了它并开始制作它。有一些问题,我不小心在本地删除了。git目录并使用git init
初始化了一个新目录。
之后,我做了几次提交,并为我的代码添加了几个特性。现在我想把代码推送到herooku dyno。
所以我执行git remote add origin git-remote-url
。尝试git push
但得到错误,做git pull
给出以下错误-
warning: packfile .git/objects/pack/pack-887ccc7bf1196e49089e449ae1edd93c87c785b8.pack cannot be accessed
fatal: bad object 00eb66f14b52f3808720aaa35285a4f32e019a05
error: heroku.com:******.git did not send all necessary objects
我该怎么办?
可能这是链接到您当前的repo状态(您再次git init
的那个),它不包含已发布的完整历史记录。
您需要再次克隆您的heroku repo,以便应用您在本地(但不完整)的repo中所做的新提交;
类似:
git clone --bare yourHerokuRepo
cd /path/to/myapp # where you deleted the `.git`)
git remote add localHeroku /path/to/yourHerokuRepo.git
git branch -m master oldmaster # where your new commits are
git fetch localHeroku # get the full history
git checkout -b master localHeroku/master # now working on the branch with
# a full history
git cherry-pick ..oldmaster # re-apply all your commits
git push