git push heroku master 说“一切都是最新的”,但该应用程序不是最新的
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21947406/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
git push heroku master says "Everything up-to-date", but the app is not current
提问by Darkmatter5
I have an app on Heroku that is running old code. I've made a small change and committed the change. I then ran
我在 Heroku 上有一个运行旧代码的应用程序。我做了一个小小的改变并承诺了改变。然后我跑了
git push heroku master
It'll say
它会说
Fetching repository, done.
Everything up-to-date
But if I go and look at the app, it's all old code. I did revert the site back to another version in Heroku about 15 days ago, but pushed updates to it since then and they worked.
但是如果我去看看应用程序,它都是旧代码。大约 15 天前,我确实将站点恢复到 Heroku 中的另一个版本,但从那时起推送了更新并且它们起作用了。
Why is heroku not getting the most current files from my github repository? Is there a way to just reset the app and push the files from github again? I have production data in the database so I do NOT want to touch it.
为什么 heroku 没有从我的 github 存储库中获取最新的文件?有没有办法重置应用程序并再次从github推送文件?我在数据库中有生产数据,所以我不想碰它。
Thanks in advance!!
提前致谢!!
回答by Kannan S
Kindly confirm your current branch is master.
请确认您当前的分支是 master。
git branch
If the pointer is not pointing the master, then check out to master branch
如果指针没有指向 master,则检出 master 分支
git checkout master
Commit your changes and try to push to heroku
提交您的更改并尝试推送到 heroku
git commit -am "xxxyyzzz"
git push heroku master
回答by levi
When you run git push heroku master
, git is assuming that you are pushing from master, so if you changes are in other branch, you will try to push your master branch without changes.
当你运行时git push heroku master
,git 假设你是从 master 推送的,所以如果你的更改在其他分支中,你将尝试推送你的 master 分支而不做任何更改。
You have two options
你有两个选择
1.Merge your changes with master and push them.
1.将您的更改与 master 合并并推送它们。
Commit your changes in your actual branch, then merge them with master
在实际分支中提交更改,然后将它们与 master 合并
git commit -a - m "your messages"
git checkout master
git merge your_feature_branch
git push heroku master
2.Push your changes from your actual branch
2.从您的实际分支推送您的更改
git push heroku your_feature_branch:master
回答by stephenmurdoch
I'm willing to bet you've forgotten to run git add .
followed by git commit -m 'xyz'
?
我敢打赌你忘了跑,git add .
然后是git commit -m 'xyz'
?
回答by techdreams
I had a similar issue and by no means my changes were visible on heroku. To reconfirm myself I even took a clone from heroku and it was obviously up to date.
我有一个类似的问题,而且我的更改在 heroku 上是不可见的。为了再次确认我自己,我什至从 heroku 中克隆了一个克隆,它显然是最新的。
I could resolve my issue only by following this approach:
我只能通过以下方法解决我的问题:
Step 1:Make a new branch from master
第 1 步:创建一个新分支master
git checkout -b new_branch
Step 2:Just add a comment in any file to make a new commit and then:
第 2 步:只需在任何文件中添加注释即可进行新提交,然后:
git add .
git commit -m "Just a test commit to push new branch to heroku"
Step 3:Push the new branch to heroku.
第 3 步:将新分支推送到 heroku。
git push heroku new_branch:master
heroku restart
You could now see your changes successfully on heroku.
您现在可以在 heroku 上成功看到您的更改。
回答by Milena
Even though this is an old issue, I wanted to update with what worked for me (a newbie) should anyone else run into this:
尽管这是一个老问题,但如果其他人遇到这个问题,我想更新对我(新手)有用的东西:
After following the instructions here (from Hudson), what finally did the trick for me was doing a "git pull" after checking out the "master" branch. Perhaps "git push heroku master" pushes out only the local branch of master?
按照此处的说明(来自 Hudson)之后,最终对我有用的是在检查“master”分支后执行“git pull”。也许“git push heroku master”只推出master的本地分支?
Of course, this assumes all required changes have been correctly merged into your master. I hadn't pulled from master on my local since the project set up because all merges (from development to master) were handled on GitHub and I had been working on new branches that were later merged with development.
当然,这假设所有必需的更改都已正确合并到您的母版中。自从项目建立以来,我没有从本地的 master 拉取,因为所有合并(从开发到 master)都是在 GitHub 上处理的,而且我一直在处理后来与开发合并的新分支。
So, to restate steps above from Hudson:
因此,重申哈德逊的上述步骤:
git checkout master
git checkout master
git pull
git pull
(here, I updated README to have a change to commit, like "Heroku deploy [date, time]"
(在这里,我更新了自述文件以进行更改以提交,例如“Heroku 部署 [日期,时间]”
git add .
git add .
git commit -am "xxxyyzzz"
git commit -am "xxxyyzzz"
git push heroku master
git push heroku master
heroku run rake db:migrate
heroku run rake db:migrate
heroku restart
heroku restart
Good luck!
祝你好运!
回答by Vladimir Djuricic
When this happens, I push previous commit hash to master like this:
发生这种情况时,我会像这样将先前的提交哈希推送到 master:
git push some-heroku-app-name SOME-COMMIT-HASH:master --force
Then I re-push master like this:
然后我像这样重新推送大师:
git push some-heroku-app-name master:master
回答by stevec
Try:
尝试:
heroku status
heroku status
This returned the following, which confirmed that the problem was with the heroku API (and not with my app!):
这返回了以下内容,确认问题出在 heroku API(而不是我的应用程序!):
"The API is experiencing delays. This may result in delays with adding new domains, new releases, and other such actions. Currently, engineers are investigating the issue."
“API 出现延迟。这可能会导致添加新域、新版本和其他此类操作的延迟。目前,工程师正在调查此问题。”
回答by Jordan Taylor
Same issue, I added a remote to my local repository with the heroku git:remote command and then pushed it.
同样的问题,我使用 heroku git:remote 命令向我的本地存储库添加了一个遥控器,然后推送它。
heroku git:remote -a your-heroku-app
git push heroku master
回答by creativemind57
Had the same issue multiple times. What worked for me if clearing my browser history or opening the app in an incognito window.
多次遇到同样的问题。如果清除浏览器历史记录或在隐身窗口中打开应用程序,对我有用。
回答by Aur Saraf
I know, I know, silly, but it happened to me so I'm leaving a warning to others: make sure the app you're pushing to is the same app you're checking for changes.
我知道,我知道,很傻,但它发生在我身上,所以我要向其他人发出警告:确保您推送的应用程序与您正在检查更改的应用程序相同。
In my case I was pushing to staging and then running a shell on production and not understanding why the static files didn't change.
就我而言,我正在推动暂存,然后在生产中运行 shell,但不明白为什么静态文件没有改变。
(It started with a real issue where static files didn't change when I pushed a new version, but it was probably a one-push fluke, and it only kept me going in circles for another hour because I was testing the wrong app.)
(它开始于一个真正的问题,即当我推送新版本时静态文件没有改变,但这可能是一推的侥幸,它只让我又绕了一小时,因为我正在测试错误的应用程序。 )