Error: warning: unable to access '/etc/gitconfig': Permission denied, when cloning a GitHub repo via gh repo clone - github-cli

On Ubuntu 20.04, I installed the gh CLI tool via:
sudo snap install gh
Then, trying to gh repo clone a public repo resulted in the error:
Error: warning: unable to access '/etc/gitconfig': Permission denied
This happened via HTTPS, and SSH with freshly generated key. Related QAs like this one point at the possibility of an issue with installation.
How to fix this, so I can have the closest thing to the good old clone with SSH key?

Likely, the snap installation was encapsulated and somehow unable to access the GitHub config file. The simplest fix in this case was to uninstall the CLI tool and reinstall it following the official docs:
# remember to logout from GH if you haven't done so...
gh auth logout
sudo snap remove gh
Now, on a new terminal (to refresh the snap-related environment variables), install via the following official steps (should work on any Debian-based system):
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo gpg --dearmor -o /usr/share/keyrings/githubcli-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
sudo apt update
sudo apt install gh
At this point we're all set. Authenticate via your favorite method (I chose HTTPS via browser), and cloning should work without issues:
gh auth login
gh repo clone <YOUR_REPO>
Hope this helps!
Cheers,
Andres

Related

GPG errors from dnf on linux9

Recently installed Rocky Linux9 on a bunch of machines. No real problems except for some packages don't want to install.
Example: confluent-kafka-2.11. If I run dnf install confluent-kafka-2.11 -vv I get the usual downloading info but it ends with
Using rpmkeys executable at /usr/bin/rpmkeys to verify signatures
Problem opening package confluent-kafka-2.11-2.0.1cp8-1.noarch.rpm
The downloaded packages were saved in cache until the next successful transaction.
You can remove cached packages by executing 'yum clean packages'.
Error: GPG check FAILED
I've tried adding --nogpgcheck but it still doesn't work. What am I doing wrong?
Same problem with elasticsearch except I was able to manually install the gpg key. This won't work as soon as the package updates though.
There are multiple solutions here.
To actually solve the gpg issue, the question is, how did you add the repo and the gpg key?
What is the output of
sudo dnf list all | grep confluent
# and
sudo dnf repolist

I have encounter an error "Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)"

when i run sudo apt update
It shows :-
E: Failed to fetch http://packages.microsoft.com/repos/code/dists/stable/InRelease Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
E: The repository 'http://packages.microsoft.com/repos/code stable InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
I ran into this issue too today. After reading a bunch of other threads on it. It is in most cases have to do with network connectivity and in my case an issue on Microsoft's end. After half an hour or so it resolved by itself.
Software&Updates - Other Software - find something http://packages.microsoft.com... and uncheck this
A workaround, use vim/nano to edit the source.list file.
sudo vim /etc/apt/sources.list.d/vscode.list
Comment the line with #
# deb [arch=amd64,arm64,armhf] http://packages.microsoft.com/repos/code stable main
save it :wq and re-run the update.
This solution is discussed in reddit
⚠️ By running the chattr +i cmd found in Reddit you will restrict the future edit for the file, use chattr -i to make it editable.
You just had to renew the the apt repository and signing key.
have a look here:
https://code.visualstudio.com/docs/setup/linux
the following code will fix your problem:
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
sudo install -o root -g root -m 644 packages.microsoft.gpg /etc/apt/trusted.gpg.d/
sudo sh -c 'echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/trusted.gpg.d/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" > /etc/apt/sources.list.d/vscode.list'
rm -f packages.microsoft.gpg

"Error Executing Command, Exiting" Error upon installation of NodeJS

I am using Ubuntu 16.04LTS.
I typed in the following command in the terminal:
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
In return, I am receiving the following error:
Reading package lists... Done
W: The repository 'http://ppa.launchpad.net/tualatrix/next/ubuntu xenial Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: The repository 'http://ppa.launchpad.net/tualatrix/ppa/ubuntu xenial Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: Failed to fetch http://ppa.launchpad.net/tualatrix/next/ubuntu/dists/xenial/main/binary-amd64/Packages 404 Not Found
E: Failed to fetch http://ppa.launchpad.net/tualatrix/ppa/ubuntu/dists/xenial/main/binary-amd64/Packages 404 Not Found
E: Some index files failed to download. They have been ignored, or old ones used instead.
Error executing command, exiting
I just installed the very old version of NodeJS and NPM from the Ubuntu repositories because I could not install the most current version. However, I still want the most current version of Node and NPM.
I had the same issue. The problem is not the nodejs installation script but another package in your package list in /etc/apt/sources.list.
The following worked for me:
1) Create backup of the file /etc/apt/sources.list just to be on the safe side:
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bu
2) Remove the packages that cause the issue:
Open /etc/apt/sources.list with root permissions, e.g.
sudo nano /etc/apt/sources.list
and remove the
http://ppa.launchpad.net/tualatrix/next/ubuntu/dists/xenial/main/binary-amd64/Packages
parts. In my case it was skype that caused the issue; you can identify the critical packages by the lines that start with E: Failed to fetch.
Afterwards, the following works fine (taken from the installation instructions):
cd ~
curl -sL https://deb.nodesource.com/setup_8.x -o nodesource_setup.sh
sudo bash nodesource_setup.sh
sudo apt-get install nodejs
sudo apt-get install build-essential
If one then types
nodejs -v
it will return
v8.9.4
(or whatever version you specified).
In case you already have anaconda installed, I recommend to install node.js inside an environment which keeps things clean. A detailed explanation on how to do this can be found here. Basically all it needs is
conda create -n webdev nodejs
plus desired python modules in case you would like to use e.g. Flask or Django.

Build-essential for openSUSE

I am a newbie on openSUSE. I needed to get build-essential for the system but could not get it using sudo apt-get install build-essential or even by using sudo apt-get update and then following it with the previous code. I found a way to install most packages of build essential through sudo zypper install -t pattern devel_basis. But however, I am not able to obtain libframe package !! I can't directly download it because mine is an account on the office computer and I don't have the root access.
I am also attaching the screenshot of my terminal.. The error is towards the end.
Screenshot
zypper info -t pattern devel_basis to see what packages have the pattern
zypper install -t pattern devel_basis to install these packages
thanks to what-is-build-essentials-for-opensuse
I'm not sure if this requires root login or just maybe sudo privileges. These can be granted by ur system administrator. You may just need to ask for them.
You need to add the repository first before trying the zypper install
The command is
zypper ar -f URL alias
where
ar is short form of addrepo command
-f instruction to zypper to add autorefresh flag to newly added repo
URL is URL of the repo which you type in a browser to visit repo
in this case (itc): http://download.opensuse.org/distribution/leap/42.2/repo/oss/
alias is name that is easy to remember. itc: openSUSE:Leap:42.2
so...
zypper ar -f http://download.opensuse.org/distribution/leap/42.2/repo/oss/ openSUSE:Leap:42.2
I had a similar problem with ubuntu/debian command.
sudo apt-get build-essential libssl-devel
it turns out in Suse build-essential and libssl-devel would be devel_basis and openssl-devel respectively. to install I then searched on google for just openssl-devel (as it was all that I needed at that time), and followed the link from https://software.opensuse.org. Hope this helps

How to configure gsutil?

I followed the Google instructions to set up gsutil. It states that after runnig 'gsutil config' in terminal I should see:
This script will create a boto config file at /.boto
containing your credentials, based on your responses to the following
questions.
Please navigate your browser to the following URL:
<http://urlto/authorization/dialog> In your browser you should see a
page that requests you to authorize gsutil to access Google Cloud
Storage on your behalf. After you approve, an authorization code will
be displayed.
Enter the authorization code:
however I get this response instead:
root#myserver# gsutil config
No command was given.
Choose one of -b, -d, -e, or -r to do something.
Try `/usr/bin/gsutil --help' for more information.
I am using gsutil version 3 on Ubuntu, and trying suggested flags with /usr/bin/gsutil does not give any sensible result.
Any suggestions?
Thanks
Pretty sure you have the "configure and manage GrandStream BudgeTone 100 VOIP and GS2000 phones" package installed, which is also called gsutil. So that is likely causing the issue. If you don't need the BudgeTone tools then remove them. Or, explicitly invoke the google tools by using the full path to your home directory where gstools was untarred/unzipped.
sudo apt-get remove --purge gsutil
sudo easy_install -U pip
sudo pip2 install gsutil
gsutil ls gs://uspto-pair/applications/0800401*
gsutil -config
This happens if you try to install gsutil using apt install gsutil which installs "GrandStream" manager instead of Google's gsutil.
First, you need to uninstall the wrong package:
sudo apt-get remove --purge gsutil
Then, you can install gsutil according to the installation guide.
Here is how you can do it in Ubuntu:
sudo apt-get install apt-transport-https ca-certificates gnupg
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
sudo apt-get update && sudo apt-get install google-cloud-cli

Resources