How to attach token to git command?

Viewed 549

I have a private repo in github.

I can't run git command to show all the tags because I'm not authorize: git ls-remote -t https://github.com/.../..git.

Is there a way to add a token or access key to this command that allow me to execute this command?

something like: git ls-remote -t https://github.com/../...git -token blabla

2 Answers

If you can shift to using ssh (git@github.com... URLs) instead of https, your keypair will automatically take care of auth without having to manually enter passwords.

Follow those steps:

  1. Go to your profile settings in Github.
  2. In "developer settings" create a key.
  3. use the key in the url: git ls-remote -t https://youuser:accesskey@github.com/../...git

This key is particularly sensitive.

hope it helps you

Related