259

I simply want to connect to my GitHub account. When I do it, I get this error message as a small red pop up on the upper right side of the page:

Items could not be retrieved, Internal server error.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Sylvain43
  • 2,617
  • 2
  • 4
  • 4
  • 7
    Strangely, I got this error roughly an hour ago, but when I checked my email, I was informed that "A third-party OAuth application has been added to your account". I may have caught the edge of the fix? – Carcigenicate Apr 21 '22 at 03:59
  • 4
    https://status.heroku.com/incidents/2413 – kͩeͣmͮpͥ ͩ Apr 21 '22 at 14:33
  • 1
    @Carcigenicate I saw the same thing today, but still no Github integration from the Heroku side. I don't think it's fixed yet. – Peter May 06 '22 at 18:02
  • Heroku reports that GitHub integration is available again. See my answer and / or the updated Heroku incident tracking page for details. – ChrisGPT was on strike May 26 '22 at 11:31

12 Answers12

180

As of May 25, 2022, at 19:52 UTC, GitHub integration has been re-enabled:

We are happy to report that the GitHub integration is re-enabled! You can now reconnect with GitHub and restore your Heroku pipeline functionality, including Review Apps, with newly generated tokens.

You can connect to GitHub immediately or wait for the enhanced integration as described in this blog post. To re-establish your GitHub connection now, please follow these instructions.

Here is what the referenced blog post says about "enhanced integration":

In an effort to improve the security model of the integration, we are exploring additional enhancements in partnership with GitHub, which include moving to GitHub Apps for more granular permissions and enabling RFC8705 for better protection of OAuth tokens. As these enhancements require changes by both Heroku and GitHub, we will post more information as the engagement evolves.

No timeline is mentioned for availability of the enhanced integration.


Between April 15 and May 25, 2022, Heroku's GitHub integration feature was disabled while Heroku investigated a security breach. During that time, deploying was still possible via other means, most notably via git push.

To mitigate impact from potentially compromised OAuth tokens, we will revoke over the next several hours all existing tokens from the Heroku GitHub integration. We are also preventing new OAuth tokens from being created until further notice. Your GitHub repositories will not be affected in any way by this action.

Which Heroku features have become non-operative due to the removal of the Heroku-GitHub integration?

  • Enabling review apps
  • Creating (automatic and manual) review apps
  • Deploying (automatic and manual) review apps
  • Deploying an app from GitHub (either manual or automatic)
  • Heroku CI cannot create new runs (automatically or manually) or see GitHub branch list
  • Heroku Button: unable to create button apps from private repositories
  • ChatOps: unable to deploy or get deploy notifications
  • Any app with a GitHub integration may be affected by this issue. To address specific integration issues, please open a case with Heroku Support

Migrating from GitHub deployment to Git deployment

At 2022-04-21 23:53 UTC, Heroku provided extended instructions for migrating from GitHub-based deployment to Git-based deployment:

While our customers remain unable to reconnect to GitHub via the Heroku dashboard, we wanted to share a supplement to the code deployment methods previously provided. For instructions on how to change your deployment method from GitHub to Heroku Git, please refer to the following Help article: How to switch deployment method from GitHub to Heroku Git with all the changes/app code available in a GitHub repo.

ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257
  • 4
    I couldn't git push to heroku. That's why I came here looking for answers. When I run `heroku git:clone -a name_of_app`, it tells me "warning: You appear to have cloned an empty repository." – Bus42 Apr 18 '22 at 20:48
  • 3
    Don't clone from Heroku. If you've never pushed your code there directly you'll get an empty repository. Use your existing local copy if you have one. If you need to clone it for whatever reason, clone from _GitHub_. – ChrisGPT was on strike Apr 18 '22 at 20:49
  • 4
    @Bus42, I'm not sure what instructions you're referring to but [cloning from Heroku has never been a recommended part of the regular workflow](https://devcenter.heroku.com/articles/git-clone-heroku-app): "A Heroku app’s Git repository is intended for deployment purposes only. Cloning from this repository is not officially supported as a feature and should be attempted only as a last resort. **Do not** use this repository as your app’s canonical “origin” repository. Instead, use your own Git server or a version control service such as GitHub." – ChrisGPT was on strike Apr 19 '22 at 21:32
  • What does "I can't push to Heroku though" mean? Consider posting a question about whatever error you're seeing. If you could push to GitHub and have Heroku deploy before this, you should be able to push to Heroku now. – ChrisGPT was on strike Apr 19 '22 at 21:33
  • GitHub integration wasn't properly configured on my local machine. I had to add the remote with `heroku git:remote -a ` then I was able to do `git push heroku main` and verify deployment with `heroku logs -a `. I honestly don't remember where I got the idea to attempt cloning from Heroku - likely from a removed comment. I have to say, I have had more security and login issues with Heroku than Firebase or Vercel. – Bus42 Apr 21 '22 at 15:06
  • I tried to push again after rebase and push force, and I got an error: `Updates were rejected because a pushed branch tip is behind its remote counterpart`. As I saw, because of the changes of the base branch (the reason of the rebase...) the push rejected, because the base branch should be pushed to Heroku too (not only to Github), and then we can push the current branch again with `git push heroku :main -f`. – Malka P Apr 25 '22 at 11:12
113

This is due to an issue reported at their status portal, here.

For now, the solution is to use another pushing strategy.

The best one, for now, is using their remote with Heroku CLI. The steps for it are:

1. Install the Heroku CLI if not yet installed

Further information about installation and setup can get here

2. Perform login with the heroku login command

You will be prompted with your default browser window for completing the login at the Heroku portal.

3. Assuming you already have your app set up at Heroku (if not, please follow this), you just need to add a new remote for your Git repository with Heroku CLI.

Run heroku git:remote -a example-app - substitute "example-app" with your app name.

4. git remote -v to check if the remote has been set successfully

You should see something like this appear as a response:

heroku  https://git.heroku.com/your-app-name.git (fetch)
heroku  https://git.heroku.com/your-app-name.git (push)

5. Push your branch to the new heroku remote

git push heroku your_branch_name

6. You should see the progress of your deployment being displayed in the terminal


The reference for this answer has been taken from here, which can also be used if further information other than the one provided in this answer is needed.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Henrique Aron
  • 1,316
  • 1
  • 5
  • 6
  • 4
    Thank you for the answer. If your local branch is different than main or master you may face "remote: Pushed to branch other than [main, master], skipping build." error. In that case run: "git push heroku your_branch_name:main" This command will push your your_branch_name to heroku remote's main branch. So, use it if you know what you do. – Furkan Yavuz Apr 19 '22 at 06:49
  • `heroku login` command shows `IP address mismatch` page.... i think pushing directly to heroku is not an option anymore.... has anyone any guesses? – Beki Apr 21 '22 at 05:13
  • worked for me (26/04/2022) 10:28am, Thank you for the help. hopefully it gets sorted soon – T.script Apr 26 '22 at 09:29
  • If this is working for you and you are now finding yourself maintaining two repos. You'll probably be copying your changes from one folder to another. I've found using the "Create Patch Serial" and then "Apply Patch Serial" to be very useful. – Zane Chung Apr 26 '22 at 13:14
  • Thanks a lot for this answer, i just want to mention in **STEP 5**, if you got this error: `error: src refspec origin does not match any` you should use this command instead: `git push heroku` – Ali May 13 '22 at 10:46
  • @Beki try `heroku login -i` – michael_vons Jul 19 '22 at 09:37
9

I'm in the same situation, and, as others stated, it's due to a Heroku security issue. In the meantime, you can deploy your code by using the Heroku CLI.

So, on the Heroku web dashboard, select Heroku Git:

Deploy with Heroku CLI

Then set up the Heroku CLI with heroku login.

Finally, if your repository already exists on GitHub, you need to add a new remote by running:

heroku git:remote -a your_app_name
git push heroku master

You can find more information about this solution in the official documentation.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
a-chris
  • 130
  • 2
  • 7
6

It is just a temporary thing, and more details about this issue are here.

You could push to both GitHub and Heroku at once for a temporary solution:

git push -u origin <branch>
git push heroku <branch>
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
BR19_so
  • 71
  • 3
  • 2
    You probably don't want to use `-u` for both of those. [`-u` / `--set-upstream` sets the upstream branch](https://git-scm.com/docs/git-push#Documentation/git-push.txt--u) so you can do things like `git push` and `git pull` without specifying a remote. If you run these for `main` you'll just be toggling that back and forth. – ChrisGPT was on strike Apr 19 '22 at 13:12
  • @Chris , Thanks for the tip! I didn’t know that, I usually just copy and paste commands that do the work (: , but this is surly a helpful tip – BR19_so Apr 20 '22 at 14:42
4

I see the previous answers, but since I was facing an issue with review-apps (PR apps), mostly you will be working with different branches in that case, so here is a solution for pushing your stuff other than the (master/main) branch to Heroku.

First make sure your remote origin is set up correctly

heroku git:remote -a your_awesome_app

You can also confirm it by git remote -v and you should see your origin pointing to your Heroku application.

git remote -v

heroku    https://git.heroku.com/your_awesome_app.git (fetch)

Here origin name is heroku.

If you want to deploy your changes from the main branch

git push heroku main

If you want to push your changes from feature branch (other than the* main branch)

Then push your feature branch to Heroku using the below command

git push heroku feature:main
  • heroku - is your origin name (confirm your origin name with git remote -v
  • feature - is your current branch which is other than main/master branch (check your branch name with git branch or git status)
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
przbadu
  • 5,769
  • 5
  • 42
  • 67
4

For those who are using this integration for deployment purposes this, I suggest you use the deploy to a Heroku GitHub action here:

Deploy to Heroku

That way, you do not have to make significant changes to your deployment workflow.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Taha Mahjoubi
  • 372
  • 4
  • 10
2

I had the same issue. I already had cli installed.

git remote

Output:

heroku
origin

git remote -v

Output:

heroku  https://git.heroku.com/YOUR-APP.git (fetch)
heroku  https://git.heroku.com/YOUR-APP.git (push)
origin  https://github.com/GitUserName/yourRepo.git (fetch)
origin  https://github.com/GitUserName/yourRepo.git (push)

Verify using the Git branch, if your branch is named main. For example, you would do:

git push heroku main

For me it is

git push heroku master

Now push your local changes

git push heroku master

Output:

To https://git.heroku.com/YOUR-APP.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://git.heroku.com/YOUR-APP.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

I do not care that it is different than its remote. I've been developing locally and did not realize the automatic Git deploys had been failing. I care about the local changes:

git push heroku master -f

Now the deployed application is working as expected.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
grey krav
  • 45
  • 10
1

If you are getting an error while trying to push, it may be due to having different branch names for development vs deployment. In such a case, follow the instruction below;

If you are developing on a branch and deploying via Git you must run:

   git push heroku <branchname you're developing on>:<branch you're deploying from>

This article goes into details on the behavior:

Duplicate Build Version Detected

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
  • What are you quoting from? It isn't the listed source. [This question](https://stackoverflow.com/questions/64265355/heroku-if-you-are-developing-on-a-branch-and-deploying-via-git-you-must-run)? Or from some screen output? Can you elaborate in your answer? Please respond by [editing (changing) your answer](https://stackoverflow.com/posts/71930016/edit), not here in comments (***without*** "Edit:", "Update:", or similar - the answer should appear as if it was written today). – Peter Mortensen May 12 '22 at 15:22
  • Not sure I understand your comment @PeterMortensen. Pls explain in simple terms. – codeSapience Jul 01 '22 at 20:37
1

Here's the easy work pattern I have used for Heroku. This is intended to help others who may not have gone through this before. I used this previously (2014-5) and had to set it up again last night to push.

First add the Heroku remote:

git remote add heroku https://git.heroku.com/YOUR-APP.git

As GitHub is often "origin" (git push origin...), this adds another remote destination, "heroku" (git push heroku...)

git remote

Output:

heroku
origin

My pattern for code/git/pushing:

  1. Local development is the same. Push to GitHub, merge, and nothing changes.
  2. Set your deploy to "Heroku git" as @a-chris outlines.
  3. To push to Heroku, simply push the correct branch to the newly added "heroku" remote source. I use the --force option to dismiss any possibility of conflict. Unless you have been using Heroku Git and branching previously, there should only be one branch - typically "master" to use.

This will trigger a deploy. You can watch or review in the dashboard as well as the terminal. Treat the new "heroku" source as a directory to dump code to promote and not a repository you want to keep history, etc. A second-class citizen in this particular pattern.

I push from my local terminal now instead of auto-deploy or via the dashboard button. If your organisation is large, I recommend controlling access. Many developers may not have experience juggling multiple destination repositories or to catch an accidental push.

To trigger a local push, be sure your master (or whatever) is up to date...watch your commit hashes!

This will set you up to follow advice such as BR19_so and others.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Marc
  • 1,895
  • 18
  • 25
1

Henrique Aron's answer is working for the local machine.

For a remote SSH server, you will face an IP mismatch error.

To resolve it:

  1. Log in to the Heroku website

  2. Go to account settings

  3. Reveal the API keys in the panel

  4. In the server CLI, type heroku login -i

  5. Input email, use the API key as the password, and you can follow the rest of the steps of a Git remote push

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Jacky Kwan
  • 51
  • 1
  • i have actually updated few things, but heroku still shows everything-is-uptodate, when i have made and pushed the changes and triying to deploy it. – Rohan Devaki Apr 26 '22 at 10:30
0

I am using a 2014 MacBook Pro with macOS 11.6.5 (Big Sur) version for command

brew tap heroku/brew && brew install heroku

I was getting an error and a message to update to the latest Xcode. The latest Xcode needed the latest macOS, which I could not upgrade to (I needed a 2015 MacBook Pro or newer). For a 2014 MacBook Pro, I was able to Install Xcode_13.2.1.xip and was able to run. Now I can push updates to Heroku.

brew tap heroku/brew && brew install heroku
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
atazmin
  • 4,757
  • 1
  • 32
  • 23
0

There is an update regarding this issue. You can now enable GitHub integration as mentioned in the update.

If it doesn't work, you can try removing the App connection to GitHub (disconnect) and adding the connection again. Adding the connection again can also be done in incognito mode because sometimes an issue occurs related to cookies (mentioned here).

Abdullah
  • 93
  • 14
  • Can you [summarise](https://stackoverflow.com/posts/72447102/edit) in your answer (in your own words)? That is, relying less on the references (that may break in the future), for a more self-contained answer. (But ***without*** "Edit:", "Update:", or similar - the answer should appear as if it was written today.) – Peter Mortensen Jun 26 '22 at 12:46