Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

agnos.is Forums

  1. Home
  2. Linux
  3. How do you use token to access github in a basic terminal?

How do you use token to access github in a basic terminal?

Scheduled Pinned Locked Moved Linux
7 Posts 7 Posters 4 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M This user is from outside of this forum
    M This user is from outside of this forum
    [email protected]
    wrote on last edited by
    #1

    So I put all of my important dot files on Github. Whenever I need to reinstall stuff, I pull the files. To get this working, I need to do the "gh auth login" where it grants the ssh key. Or I can create a token for that specific machine on Github. This is a long list of letters/numbers that I then copy when doing "git clone".

    During installations of Arch or even a minimal Debian, how do you do this? There are no browsers, so the command "gh auth login" would get stuck.

    Is there a better way to do this, other than making the dotfiles repo public?

    paequ2@lemmy.todayP U T B 4 Replies Last reply
    1
    0
    • System shared this topic on
    • M [email protected]

      So I put all of my important dot files on Github. Whenever I need to reinstall stuff, I pull the files. To get this working, I need to do the "gh auth login" where it grants the ssh key. Or I can create a token for that specific machine on Github. This is a long list of letters/numbers that I then copy when doing "git clone".

      During installations of Arch or even a minimal Debian, how do you do this? There are no browsers, so the command "gh auth login" would get stuck.

      Is there a better way to do this, other than making the dotfiles repo public?

      paequ2@lemmy.todayP This user is from outside of this forum
      paequ2@lemmy.todayP This user is from outside of this forum
      [email protected]
      wrote on last edited by
      #2

      Maybe you could go to:

      Settings > Developer Settings > Personal Access Tokens > Tokens (Classic)

      And then create a new token there.

      Then you should be able to clone a private repo as long as you have git installed.

      When you git clone your private repo, git will ask for your username, enter that. Then it's gonna ask for your password. Don't enter your GitHub password. Enter your token.

      Clone should work.

      J 1 Reply Last reply
      0
      • paequ2@lemmy.todayP [email protected]

        Maybe you could go to:

        Settings > Developer Settings > Personal Access Tokens > Tokens (Classic)

        And then create a new token there.

        Then you should be able to clone a private repo as long as you have git installed.

        When you git clone your private repo, git will ask for your username, enter that. Then it's gonna ask for your password. Don't enter your GitHub password. Enter your token.

        Clone should work.

        J This user is from outside of this forum
        J This user is from outside of this forum
        [email protected]
        wrote on last edited by
        #3

        Yes, PSK will work.

        1 Reply Last reply
        0
        • M [email protected]

          So I put all of my important dot files on Github. Whenever I need to reinstall stuff, I pull the files. To get this working, I need to do the "gh auth login" where it grants the ssh key. Or I can create a token for that specific machine on Github. This is a long list of letters/numbers that I then copy when doing "git clone".

          During installations of Arch or even a minimal Debian, how do you do this? There are no browsers, so the command "gh auth login" would get stuck.

          Is there a better way to do this, other than making the dotfiles repo public?

          U This user is from outside of this forum
          U This user is from outside of this forum
          [email protected]
          wrote on last edited by
          #4

          You can use your token with the REST api. And use that to do whatever you want.

          you can also use your token for git clone like so:

          $ git clone https:/git:[email protected]/myown/repo
          
          davel@lemmy.mlD 1 Reply Last reply
          0
          • U [email protected]

            You can use your token with the REST api. And use that to do whatever you want.

            you can also use your token for git clone like so:

            $ git clone https:/git:[email protected]/myown/repo
            
            davel@lemmy.mlD This user is from outside of this forum
            davel@lemmy.mlD This user is from outside of this forum
            [email protected]
            wrote on last edited by
            #5

            Best practice is not to use raw credentials on the command line because it exposes them in process listings and shell history files.

            https://git-scm.com/docs/gitcredentials

            1 Reply Last reply
            0
            • M [email protected]

              So I put all of my important dot files on Github. Whenever I need to reinstall stuff, I pull the files. To get this working, I need to do the "gh auth login" where it grants the ssh key. Or I can create a token for that specific machine on Github. This is a long list of letters/numbers that I then copy when doing "git clone".

              During installations of Arch or even a minimal Debian, how do you do this? There are no browsers, so the command "gh auth login" would get stuck.

              Is there a better way to do this, other than making the dotfiles repo public?

              T This user is from outside of this forum
              T This user is from outside of this forum
              [email protected]
              wrote on last edited by
              #6

              Just use SSH keys.

              https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent

              And use SSH urls (git@....) instead of HTTPS urls (https://...) when cloning.

              1 Reply Last reply
              0
              • M [email protected]

                So I put all of my important dot files on Github. Whenever I need to reinstall stuff, I pull the files. To get this working, I need to do the "gh auth login" where it grants the ssh key. Or I can create a token for that specific machine on Github. This is a long list of letters/numbers that I then copy when doing "git clone".

                During installations of Arch or even a minimal Debian, how do you do this? There are no browsers, so the command "gh auth login" would get stuck.

                Is there a better way to do this, other than making the dotfiles repo public?

                B This user is from outside of this forum
                B This user is from outside of this forum
                [email protected]
                wrote on last edited by
                #7

                Personally I find git-credential-manager much easier to use.

                It manages Oauth2 for you.

                Or ssh keys.

                1 Reply Last reply
                0
                • System shared this topic on
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups