3

I code on my local machine, push it to my remote repository on github and then login via ssh on the target machine, pull it, build it and run it.

This typically requires me to enter my login data everytime I want to do it, on the local machine. I have discovered git cli, so I installed it on the target machine.

$ gh --version
gh version 2.6.0-15-g1a10fd5a (2022-03-16)
https://github.com/cli/cli/releases/latest

I authenticated myself via

$ gh auth login

and now I want to simply pull the latest commit. But there's no pull command. There is a pull request command, i.e. gh pr but this just tells me there aren't any.

How can I simply pull my latest commit, akin to git pull, without needing to type in my login information again?

SwissCodeMen
  • 4,222
  • 8
  • 24
  • 34
infinitezero
  • 1,610
  • 3
  • 14
  • 29
  • 1
    If you have to enter your password all the time, you probably should look into ssh keys. Create a key on your local machine, and install it both on your target machine and in GitHub, and then you should be able to do most of your operations without entering any passwords. – joanis Aug 06 '22 at 13:29

2 Answers2

3

You could do gh repo sync it will update the local repo by comparing it with the remote repo.

Omi Harjani
  • 737
  • 1
  • 8
  • 20
2

You can‘t (as fas as I know).

The GitHub CLI is a command-line tool to do the work as in GitHub itself like pull requests, issues, GitHub Actions, and other GitHub features.

The same as on GitHub-website, but simple on the command-line. If you want to pull the latest changes from a GitHub repository, you need Git (the version-control tool) and the command git pull.

SwissCodeMen
  • 4,222
  • 8
  • 24
  • 34
  • 1
    And how do I avoid to put in my Auth key again and again? Do I need to upload my SSH public key? – infinitezero Aug 06 '22 at 11:03
  • @infinitezero Cache credentialsHTTPS: https://stackoverflow.com/q/5343068/7976758 , Found in https://stackoverflow.com/search?q=%5Bgit%5D+cache+credentials – phd Aug 06 '22 at 11:09
  • For that, look at the GitHub Docs [Creating a personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token) – SwissCodeMen Aug 06 '22 at 11:10
  • @infinitezero SSH: https://stackoverflow.com/search?q=%5Bgit%5D+%5Bssh%5D+passwordless – phd Aug 06 '22 at 11:11