Git + Github + Heroku

Heroku and GitHub: Items could not be retrieved, Internal server error

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.

heroku and github at the same time

You can have multiple remotes on a git installation. You would have a github remote, and a heroku remote.

Assuming you already have github setup, then you probably push to github with something like:

git push origin master

origin is your remote, and master is your branch.

Follow the instructions in getting started with Heroku choose your desired language and continue through the tutorial. This tutorial assumes that you already have github setup, and will show you how to create your heroku remote - via heroku create.

You then push to github as normal, and push to heroku via:

git push heroku master

The same format applies - heroku is your remote, and master is your branch. You are not overwriting your Github remote here, you are adding another, so you can still do both pushes via one commit with workflow such as:

git add .
git commit -m "Going to push to Heroku and Git"
git push origin master -- push to Github Master branch
git push heroku master -- push to Heroku

How to find the github repository associated with a heroku app?

I just tried heroku slugs:download -a myapp and get

Warning: slugs:download is not a heroku command.

You would need to install the heroku/heroku-slugs plugin first, in order for that command to be recognized.

heroku plugins:install heroku-slugs

But try first, as you did

heroku git:clone -a APP-NAME

And then git log -1: that will give you the SHA1 of the latest commit.

You can then do on GitHub a Commit search by hash.

Example:

https://github.com/github/gitignore/search?q=hash%3A124a9a0ee1d8f1e15e833aff432fbb3b02632105&type=Commits


The OP stevec mentions in the comments using "How to clone all repos at once from GitHub?" to handle more than 100 repositories and (critically) download the private ones too (not just public).

That is: write a bash script that clones every repository on my account and somehow searches for a particular SHA.

I suggests a simple git log -1 SHA, or;, following "How to check if the commit exists in a Git repository by its SHA-1":

git rev-parse -q --verify "$sha^{commit}" > /dev/null

The OP adds:

I realised your initial solution definitely works (even for private repos).

heroku git:clone -a APP-NAME
git log -1,
https://github.com/search?q=hash%3A<SHA>

How to git pull from github and push to heroku?

First login heroku

heroku login

clone from the heroku app

heroku git:clone -a heroku-app-name
cd heroku-app-name

check remote heroku

git remote -v

you should see

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

add remote origin

git remote add origin git@github.com:yourname/reponame.git
git remote -v

you should see

heroku  https://git.heroku.com/heroku-app-name.git (fetch)
heroku https://git.heroku.com/heroku-app-name.git (push)
origin git@github.com:yourname/reponame.git (fetch)
origin git@github.com:yourname/reponame.git (push)

fetch remote origin and update remote heroku

git pull origin master
git push heroku master

Export Heroku App to a new GitHub repo

A "remote" is pretty much just a name and a couple of URLs. The URLs are often the same. You can see your existing remotes by running git remote -v in your project directory, e.g.

$ git remote -v
origin https://github.com/github/hub.git (fetch)
origin https://github.com/github/hub.git (push)

Here I have one remote, origin, whose fetch and push URLs are the same.

If you run that command in your repository you will probably see at least a remote called heroku pointing at the Git host that underlies Heroku (https://git.heroku.com/...). This is what the Heroku CLI uses to deploy your application.

You need to add a new remote for your GitHub repository. If you haven't already, create a new repository on GitHub to contain your project. Do not initialize the project with a README, .gitignore, or LICENSE file¹. Make note of the URL that GitHub shows you after you've done this.

Now add the new repository as a remote with a name that makes sense:

git remote add <name> <github-url>

You can now push to the new remote using git push <name>.

Regular GitHub access rules apply—you'll need to have an SSH key set up or provide your password. If you use 2FA and want to use HTTPS you'll need to set up a personal access code and use that instead of your password.


¹If you create these files you'll end up with a new commit on GitHub that doesn't exist in your local copy. In this case you won't be permitted to do a regular push.

How can I download my code from heroku using GitHub method

Heroku does not proxy any non-git push deployments to its underlying repository:

You cannot clone your app’s source from Heroku if you deploy your app with any method besides git push. Other deployment methods do not update your app’s Heroku Git repo, causing heroku git:clone to return an empty repository.

Since you've deployed by pushing to GitHub, simply clone from GitHub.

Items could not be retrieved, Internal server error [Heroku - GitHub Integration]

For those who are using this integration for deployment purposes this, I suggest you use the Heroku-cli to deploy in meanwhile they fix their issue

https://devcenter.heroku.com/articles/heroku-cli



Related Topics



Leave a reply



Submit