Work locally and push with git

Hi,

I cloned my project with git in order to work locally.

After i create a new branch, commit some changes and then push - it requests for my username and password:

Username for ‘https://api.glitch.com’: myemail
Password for ‘https://myemail@api.glitch.com’:

and for every credentials i try (facebook, my credentials), i get:

error: RPC failed; HTTP 401 curl 22 The requested URL returned error: 401
fatal: the remote end hung up unexpectedly

any idea what should be my credentials? or am i doing something wrong?

  • i signed with facebook.

Thanks!

It’s undocumented at the moment as we want to improve the UX, but the username is your access token and the password is blank. You can get your access token by viewing the dev tools console and filtering on api.

i did not understand where i should get the access token from:
“by viewing the dev tools console and filtering on api”

should i run a command from the console?
is it related to a specific project or is it a general one for my account?

CTRL+SHIFT+I / F12
he means the console of your browser

can you please explain how? or send a photo of what i should be looking for?

important: do not paste screenshots in which your access token is visible, or anyone will be able to steal your user

These instructions are for Chrome:

  1. go to glitch.com/edit (any project will be fine)
  2. if you are on Windows, press F12. If on macOS, press Cmd+Shift+I (capital i)
  3. a “webconsole” will open, with several tabs. Make sure you are in the “console” tab on it.
  4. type application.currentUser().persistentToken() and press enter

Your access token will be printed in quotes. Remove the quotes and use the token as your username in the git url, as Gareth explained above.

Great we found it!
very helpful, thank you all!

2 Likes

Sorry to revive this thread, but I made a similar mistake while pushing some code commits.
Instead of using the access token, I accidentally entered my Glitch username while committing, which leads to an RPC error.

Now I have copied my user access token. But while pushing the code, it uses the earlier entered username by default and does not prompt for another set of credentials.

Can someone please help me to reset the earlier set credentials on my local repo so that I can use the access token to push code successfully? Thanks!

Hi @neil4droid! You can change things in your .gitconfig file by either going into the file and changing them directly, or in the command line with the following:

git config --global user.name "[your token here]"

Give that a try and let us know if it worked!

Hi @lyzidiamond ! Thanks for the quick reply!

I changed the user.name entry in the global git config, but it doesn’t work!

Update: Solved!

On Windows(where I am working), the Glitch credentials are stored in the Windows utility called Windows Credential Manager, which can be accessed from Control Panel - User Accounts - Credential Manager. Under the Windows Credentials, there is an entry for api.glitch.co.m, where you can modify the previously entered credentials.

If someone else is stuck in a similar predicament and is not working on Windows, refer to this answer on Stack Overflow regarding how git manages credentials.

Also if like me, Git Credential manager or VS Code keeps asking you for the credentials for every time you push changes, refer to this answer on how to modify your remote origin URL to include your user access token and password so that manual authentication is not required.

2 Likes