215 questions
-4
votes
1
answer
157
views
How can I list all branches from every repository in a GitHub account using GitHub CLI? [closed]
I'm using GitHub CLI and PowerShell, and I want to list all branches from every repository under a specific GitHub username.
gh repo list only returns the repo names, but I want a way to loop through ...
2
votes
0
answers
343
views
Get `gh pr list` to output all fields as JSON
I would like to get the Github CLI to give me JSON output including all JSON fields (I find it easier to see what's available and useful by quickly checking example output rather than deciphering ...
3
votes
1
answer
505
views
GitHub Personal Access Token returns 401 "Bad credentials" but CLI works perfectly - What's the difference?
Problem Summary
All Personal Access Tokens return 401 Bad credentials when using curl or direct API calls, but GitHub CLI authentication works perfectly. This affects ALL tokens including newly ...
0
votes
1
answer
166
views
GitHub CLI says "current directory is not a git repository" even after running `git init`
I have done the following:
Create a folder called "TestGitHubCliRepo".
Create a file named "README.md" inside the folder.
Go to the folder in terminal.
Run git init.
Run gh repo ...
1
vote
1
answer
120
views
how to allow GitHub_cli different permissions in different organizations
I have owner rights on different GitHub organizations and admin rights on a lot of the repositories in these organizations.
I am now working on a script that can create and delete repos using gh. So I ...
-1
votes
2
answers
148
views
Why gh cli create master branch instead of the main branch? [closed]
I was using gh cli to create a new repository and clone immediately to use using the gh repo create <reponame> --public --clone and involuntarily I pushed on the main branch and realized that gh ...
0
votes
0
answers
149
views
How to retrieve Project custom properties or field values in Octokit.GraphQL.Net
We have a github project with custom field such as Sprint and story points.
Below is the sample query that I am trying using Octokit.GraphQL.Net
var query = new Query()
.Repository("my-repo",...
1
vote
1
answer
663
views
Download artifacts from a different GitHub repo with gh cli
Looking at this documentation I can use curl version of the provided example:
curl -L -H "Accept: application/vnd.github+json" -H "Authorization: Bearer GITHUB_CODE" -H "X-...
0
votes
1
answer
286
views
Github API graphQL - Get certain organization user organizationVerifiedDomainEmails
I am the admin of my github organization. I want to get organization member emails from their username. I have the following gh cli command that will give me all members, but I want a specific member.
...
0
votes
0
answers
39
views
VSCode port forwarding through powershell or batch
I have a project in visual studio code, but has to port forwarded through the Ports tab's port forwarding feature. I am trying to make a powershell/batch script to automate the awkwardly long process ...
0
votes
1
answer
204
views
How can I store the output of a jq process to a github cli environment variable
I have a jq process that looks at the values of a JSON file, checks a few things, and then determines if the current object is available to perform something against. The problem I have right now is ...
-1
votes
1
answer
348
views
Unable to edit and capture Super Linter error into GitHub Issue
I am using Superlinter actions in GitHub Actions for code linting. I would like to trigger action once issue is created, and capture error that is raised by SQLFluff (Linter in SuperLiner) into the ...
0
votes
2
answers
412
views
How to auto close GitHub issue using GitHub CLI in GitHub Actions
I would like to automatically close the issue once it is created. For this I referred to Actions marketplace and this action. Currently my code in YAML file looks like below. GitHub token is saved in ...
1
vote
1
answer
115
views
remote: Repository not found while using GitHub CLI
I recently started using the GitHub CLI to manage multiple GitHub accounts on the same device. However, I've been unable to push code to a repository I was added to. I've checked, and the account I'm ...
-1
votes
1
answer
49
views
Branch still pushing from old account
I needed to switch github accounts to push something to a company github account. I tried to change to my new username but constantly get rejected.
remote: Permission to Company/project.git denied ...
0
votes
1
answer
187
views
Making a secret gist public using gh cli
I've accidentally created a gist as secret gist via the gh (GitHub) CLI.
I'd like to make this secret gist now public. What CLI command can I use for this? Or is this feature not available in the CLI (...
4
votes
1
answer
1k
views
unknown command "attestation" for "gh"
I was trying to upgrade all Homebrew packages with
brew upgrade
and encountered the following error:
unknown command "attestation" for "gh"
4
votes
1
answer
3k
views
How to do `gh auth login` when run in headless mode?
I'd like to do gh auth login on a headless server and still use the browser based flow (instead of the token). How do I do this?
By default nothing happens after pressing "Enter" here:
$ gh ...
0
votes
0
answers
53
views
Github CLI: repo counts without details
The --limit option of gh has an upper value limit. This is set to reasonable values, and for understandable reasons; as discussed here.
It can be convenient to format the output of gh as JSON, and ...
0
votes
0
answers
47
views
pip installing packages via external tools
I am trying to install an internal python package via
pip install -r requirements.txt
requirements.txt
black
numpy
scipy
interpackage @ git+ssh://[email protected]/.....
otherpackage @ git+ssh://git@...
0
votes
0
answers
255
views
Create a PR and Auto merge before Test deployment with GitHub Actions
We are using dev branch for dev env and main branch for test env. I need to create a auto merge PR from dev to main branch via GitHub actions once the dev environment deployment is completed. So ...
2
votes
2
answers
347
views
gh has different output when captured with Python subprocess.run
Within Python, I am trying to capture the full stderr output produced from the shell command:
$ gh repo fork --remote
! knoepfel/larvecutils already exists
✓ Using existing remote origin
The python ...
0
votes
0
answers
495
views
Implementing CI/CD Pipeline between Github Actions and my AWS S3 Bucket
I'm stuck in my CI/CD pipeline between Github Actions and AWS S3. I wrote a YAML script to deploy my website to S3, but when I push my website to the remote Github repository, it doesn't deploy to my ...
0
votes
1
answer
1k
views
Use CLI to write a comment pinned to a file and line number on a github pull request
I would like to comment on a pull request from a script using gh github cli. When using the web interface one could click on a change, like in: How can I manually add suggestions in code reviews on ...
0
votes
1
answer
321
views
Use jq to get list of files that need editing from GitHub API for each repo returned
I am trying to query the GitHub API using gh and use the returned JSON to give me a list of repos that have matches for my search, and against each repo, I want a list of the filenames that need ...
1
vote
1
answer
1k
views
Branch protection via CLI
I created a GitHub Actions workflow that should add a branch protection rule so that a commit on the main branch is only possible via a PR. The PR should have at least 1 reviewer.
I have the following ...
-1
votes
1
answer
259
views
Implement workflow to Label Issue as "blocked" Based on Dependencies - Not Found error
I am trying to implement a GitHub Actions workflow that automatically labels an issue as "blocked" if it has dependencies on tasks that are still in progress. The action should be triggered ...
-1
votes
1
answer
353
views
Implement workflow to label Issue as "blocked" based on dependencies
I am trying to implement a GitHub Actions workflow that automatically labels an issue as "blocked" if it has dependencies on tasks that are still in progress. The action should be triggered ...
3
votes
1
answer
1k
views
How can I check if a local git branch has been squash-and-merged into main on GitHub, using either the git or gh CLI tools?
I have an old branch locally on my computer, I am interested in checking if that branch has (or had) a PR (open, merged or closed) to our GitHub repo. The repo is set as the remote origin.
How can I ...
0
votes
1
answer
225
views
Displaying nested tables using --template option in gh cli
How do I go about displaying display tables from the gh cli output?
E.g. I want to display the labels for a certain set of PRs along with the PR information
Doing the below does not work
> gh pr ...
1
vote
1
answer
1k
views
How can I use the GitHub CLI to download a release from a private repo?
I'm trying to download assets from a release on a private repository.
My current code would be:
run: gh release download release -R Hostname/RepoName -D
This only works if the repository is public. ...
0
votes
1
answer
145
views
Getting pull request messages that merged into master branch
I have a GitHub Actions workflow in place that is triggered whenever a PR is closed and merged. This action automatically generates an APK and attaches it to a new GitHub release with a specific tag.
...
0
votes
0
answers
215
views
Is there a programmatic way to get the "Tracked By" relationship for github issues
GitHub let's me create tasks lists in the issue specification like so:
- [ ] #1
- [ ] https://github.com/desktop/desktop/pull/1
which will create a special relationship called "Tracked In" ...
0
votes
1
answer
3k
views
Error: Failed to deploy web package to App Service. Error: Deployment Failed, Package deployment using ZIP Deploy failed. Refer logs for more details
Deployment Failed. deployer = GITHUB_ZIP_DEPLOY deploymentPath = ZipDeploy. Extract zip. Remote build. Error: Failed to deploy web package to App Service. Error: Deployment Failed, Package deployment ...
0
votes
1
answer
976
views
GitHub search a path in a repository via the GitHub CLI
I have this search via the code browser:
repo:RapidCircle/vscode path:.vscode/
It searches for a path inside a repository and it does returns results.
No matter how I try it to translate it to ...
0
votes
2
answers
862
views
How to list all issues of a GitHub repository with all assignees
I use the gh command to list and print all issues to a CSV file, but I can't get the all assignees also.
The complete command I use:
gh issue list --limit 1000 --state all | tr '\t' ',' > issues....
4
votes
1
answer
4k
views
GitHub CLI from GitHub Actions workflow
According to GitHub Docs, one can use GitHub CLI commands in a workflow.
I am trying to programmatically update the description of the repository from a workflow in that repository, and the only ...
0
votes
0
answers
429
views
Command gh issue list to export issues to CSV file
this command
gh issue list --limit 10000 --state all --json number,title,assignees,state,labels,url |^
jq -r '["number","title","assignees","state","labels&...
0
votes
1
answer
2k
views
gh release create -R error Invalid target_commitish parameter
When trying to run gh release create v0.0.1 -R https://github.com/path/to/repo I get a an error as below.
HTTP 400: Invalid target_commitish parameter (https://api.github.com/repos/path/to/repo/...
0
votes
1
answer
682
views
How to get gh api command to ignore errors so it does not drop out of loops?
I am trying to run in a loop some gh api GET commands (Github cli), but it stops once it hits any error (e.g., the url not found or whatever it was filtered on and looking for was not found). I would ...
0
votes
0
answers
111
views
Connectivity issue while creating a release with GitHub CLI
GHA workflow step:
- name: create release
run: |
gh release create v1.0.0 --repo myrepoowner/myrepositoryname/Release --title "My Release" --notes "This is the first version of my ...
0
votes
1
answer
303
views
Manage config of my github repos with the GithubCLI from a Girhub Actions Workflow
I try to manage my Github Repo Settings from a Github Actions workflow to ensure there are no unwanted changes and everything is consistent across lots of repos (I want to use the same workflow for ...
0
votes
1
answer
468
views
Fetching json content from a git diff command result
Git diff tag1.2 tag1.5
Output for the above command is
**Tag
Some character
@@262728
{
'Code-version':'1.5',
'changes':[
'code-repo':'2.1']
}
**Tag
Some character
@@262728
{
'Code-version':'1.4',
'...
0
votes
1
answer
3k
views
Github CLI (gh) Get PR Info After Merge or Push to Branch
After a pull request is merged to a branch, how can I obtain the details/info about that newly-merged PR (the PR number, message, merge time, etc.) using the Github CLI?
0
votes
1
answer
284
views
Git fetch not fetching from upstream
I have cloned a fork repo using GitHub CLI gh:
gh repo clone felipeplets/Auto-GPT
In order to check out an upstream branch locally I then ran:
git fetch --all
git switch -c stable upstream/stable
I ...
0
votes
0
answers
276
views
GitHub CLI search repos does not recognize existing repo
Using gh search reports that there is a test003 repo. Why does it report that the test003 repo does not exist in the second command?
PS C:\> gh search repos 'user:Liturgist'
Showing 2 of 2 ...
2
votes
1
answer
237
views
Netlify error on build image Xenial Xerus deprecated
Build image deploy error
[Disclaimer: I'm a beginner on deployment of apps]
Hi there,
I tried to deploy my web page (Nextjs) on Netlify and I'm getting a weird error on github CLI. When I see the logs ...
0
votes
1
answer
677
views
Invite members to GitHub org using Email ID through commandline or API
I was using following GitHub CLI command to add new member to a GitHub org through the command line. I am using the username to add:
# GitHub CLI api
# https://cli.github.com/manual/gh_api
gh api \
...
2
votes
0
answers
1k
views
GitHub CLI "gh repo clone <username>/<repo-name>" keeps requesting username/password even though I am already authenticated
I am trying to clone a repository from my GitHub account. I have logged into my account using:
> gh auth login --with-token < gh-token.txt
> gh --version
gh version 2.4.0+dfsg1 (2022-03-23 ...
0
votes
2
answers
1k
views
Unable to run github cli in interactive mode
I am trying to create a repo using GitHub cli the command that I've used is gh repo create <repo name> but I am getting the following error
--public`, `--private`, or `--internal` required when ...