Git error when pushing

I’m currently working on a continuous deployment pipeline to upload my git repository to Glitch. Everything works fine until the pipeline attempts to push the local changes.

The error occurs from line 13-15 (see image)

This is the command I use to fetch the git repository (from Glitch)

git clone https://${GLITCH_TOKEN}@api.glitch.com/git/${GLITCH_APP_NAME} /glitch

The error indicates that the remote returns a HTTP 403 Forbidden status. Although I do not understand why that is.

Is your project private? This is the only explanation i can think of.
That or glitch only allows git clone or git pull. In other words, the repo only lets you import the code.

Run git config receive.denyCurrentBranch ignore in your project terminal and try to deploy it again.

Already tried, didn’t work.

If it was private it shouldn’t matter, because my token has write privileges to the project. Anyway, the project is public: ~testing-ihack2712-1

@glitch_support Do you have any ideas on how to fix the issue? (sorry for the tag btw)

  • Try removing the protocol in front of the address so that it’s in the form of user:token@api.glitch.com
  • Replace the project name with the project ID
  • Append .git to the end of the URI

I would suggest you try variations of all three. I’m going to check to see how I push to my repository.

The project ID? I thought the name of the project was the ID. I don’t believe that will fix my issue though. There is an error when sending data back to the git endpoint. Receiving works fine.

Hi there! Sorry to hear you’re having trouble pushing to your Glitch project’s git repository. Just to check first, where did you get the GLITCH_TOKEN from? Does it exactly match the value that you see when you go to your project and click Tools > Import and Export > Your Project’s Git URL?

It makes sense that pulling from the repo works if it’s a public project; you don’t need a token at all for that operation. If there’s a typo in the GLITCH_TOKEN though, this could cause the 403 when attempting to push back to that repo.

If the token looks right, could you try cloning and pushing a change to another glitch project and see if that works?

Otherwise if it’s ok with you, I can see it something’s up with this project in particular by attempting to push a small comment change to your repo as a Glitch admin superuser - let me know if that’s ok with you.

Thanks!
Sheridan

2 Likes

Hi @sheridan The token comes from the persistentToken in the cachedUser object on Glitch.

I’ll create another Glitch project in a few minutes and see if the issue still persists.

The token is definetely correct. It is hidden in the output of Done (my CI/CD pipeline), because it is a secret. I did double check that the token is the exact same as I have on my client (on the Glitch website).

I would be very happy if you check if something’s up with it. The glitch project is actually completely empty, the only thing it contains is the .git directory (I didn’t want to delete that in case it would cause issues. I then commited the new changes (inside of the glitch terminal). When I fetch it, it should as well come out empty.

Please do check if something is wrong with the project, if you need explicit permission then you have my permission to do all kinds of things to it as I created the project to test my pipeline.

Thanks,
Richard.

I’ve now:

  1. re-added the token in drone to make sure that they’re matching.
  2. created a new Glitch project.

Ended up with the same results as previous builds.

P.S. After a bit of checking I went back to one of my previous posts about using git and glitch together. It seems that previously using the peristentToken worked, although has been discontinued and we now must use the gitAccessToken property.

The issue is now fixed and the pipeline is expected to run without issues. Thanks for all the help.

1 Like