ssh_exchange_identification issue raising when trying to install Homebrew in my macOS Sierra 10.12.6 - objective-c

I have searched many answers. But, none of them solved my issues.
I have tried to install homebrew via terminal, by using /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Following error received:
Attempt 1:
Donal-Mac-mini:~ mymac$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
==> This script will install:
/usr/local/bin/brew
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
/usr/local/Homebrew
Press RETURN to continue or any other key to abort
==> Downloading and installing Homebrew...
ssh_exchange_identification: read: Operation timed out
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Failed during: git fetch origin master:refs/remotes/origin/master --tags --force
Donal-Mac-mini:~ mymac$
Attempt 2:
Donal-Mac-mini:~ mymac$ git clone https://github.com/Homebrew/homebrew.git
Cloning into 'homebrew'...
ssh_exchange_identification: read: Operation timed out
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Donal-Mac-mini:~ mymac$

Issue fixed with the help of these link.
By Adding, SSH keys to my GitHub account and tried to install Homebrew.
Successfully installed.
Following steps:
Generate Key to your GitHub Account:
ssh-keygen -t rsa -b 4096 -C "yourusername#github.com"
Password:
It will ask minimum 5 chars password
To Check PORT:
eval "$(ssh-agent -s)"
Add Generated Key to Git:
ssh-add -K ~/.ssh/id_rsa
Copy that Key:
pbcopy < ~/.ssh/id_rsa.pub
PASTE IN SSH KEYS under SETTINGS in YOUR GITHUB ACC:
Next in Terminal,
ssh -T git#github.com
Hi yourusername! You've successfully authenticated, but GitHub does not provide shell access.
Start to Install Homebrew.

Related

How do I resolve Invalid SSH Key Entry error when starting App with GCE

I'm trying to launch my app on Google Compute Engine, and I get the following error:
Sep 26 22:46:09 debian google_guest_agent[411]: ERROR non_windows_accounts.go:199 Invalid ssh key entry - unrecognized format: ssh-rsa AAAAB...
I'm having a hard time interpreting it. I have the following startup script:
# Talk to the metadata server to get the project id
PROJECTID=$(curl -s "http://metadata.google.internal/computeMetadata/v1/project/project-id" -H "Metadata-Flavor: Google")
REPOSITORY="github_sleepywakes_thunderroost"
# Install logging monitor. The monitor will automatically pick up logs sent to
# syslog.
curl -s "https://storage.googleapis.com/signals-agents/logging/google-fluentd-install.sh" | bash
service google-fluentd restart &
# Install dependencies from apt
apt-get update
apt-get install -yq ca-certificates git build-essential supervisor
# Install nodejs
mkdir /opt/nodejs
curl https://nodejs.org/dist/v16.15.0/node-v16.15.0-linux-x64.tar.gz | tar xvzf - -C /opt/nodejs --strip-components=1
ln -s /opt/nodejs/bin/node /usr/bin/node
ln -s /opt/nodejs/bin/npm /usr/bin/npm
# Get the application source code from the Google Cloud Repository.
# git requires $HOME and it's not set during the startup script.
export HOME=/root
git config --global credential.helper gcloud.sh
git clone https://source.developers.google.com/p/${PROJECTID}/r/${REPOSITORY} /opt/app/github_sleepywakes_thunderroost
# Install app dependencies
cd /opt/app/github_sleepywakes_thunderroost
npm install
# Create a nodeapp user. The application will run as this user.
useradd -m -d /home/nodeapp nodeapp
chown -R nodeapp:nodeapp /opt/app
# Configure supervisor to run the node app.
cat >/etc/supervisor/conf.d/node-app.conf << EOF
[program:nodeapp]
directory=/opt/app/github_sleepywakes_thunderroost
command=npm start
autostart=true
autorestart=true
user=nodeapp
environment=HOME="/home/nodeapp",USER="nodeapp",NODE_ENV="production"
stdout_logfile=syslog
stderr_logfile=syslog
EOF
supervisorctl reread
supervisorctl update
# Application should now be running under supervisor
My instance shows I have 2 public SSH keys. The second begins like this one in the error, but after about 12 characters it is different.
Any idea why this might be occurring?
Thanks in advance.
Once you deployed your VM instance, its a default setting that the SSH key isn't
configure yet, but you can also configure the SSH key upon deploying the VM instance.
To elaborate the answer of #JohnHanley, I tried to test in my environment.
Created a VM instance, verified the SSH configuration. As a default configuration there's no SSH key configured as I said earlier you can configure SSH key upon deploying the VM
Created a SSH key pair via CLI, you can use this link for instruction details
Navigate your VM instance, Turn off > EDIT > Security > Add Item > SSH key 1 - copy+paste generated SSH key pair > Save > Power ON VM instance
Then test the VM instance if accessible.
Documentation link How to Add SSH keys to project metadata.

Generating SSH key in git bash, i can't get git agent

When I am trying to generate SSH key in git bash, I can't get git agent when we run this command
eval $(ssh-agent -s)
then I will get this error
unix_listener: cannot listen on path /tmp/ssh-xoEnzGUu8XxU/agent.1287: Permission denied
How can I resolve this?
As seen here, that could be a permission issue for writing the SSH socket.
Check the permission associated to /tmp or /tmp/ssh-xoEnzGUu8XxU/agent.1287
Or try:
eval $(ssh-agent -a ~/.ssh-agent.$$)
The socket will be written in your $HOME instead of /tmp: no more permission issue.

Manjaro install ncurses5-compat-libs

I'm trying to install this package ncurses5-compat-libs but I can because of the following problem.
What I did:
1. yay ncurses5-compat-libs
There are 2 types of errors:
Either I will check 'Y' and I will add the key, so in this case, I will receive the error message as follow
gpg: keyserver receive failed: Permission denied
==> Error: Problem importing keys
Or I will check as 'n' to don't add the key and I will receive
==> Verifying source file signatures with gpg...
ncurses-6.1.tar.gz ... FAILED (unknown public key 702353E0F7E48EDB)
==> ERROR: One or more PGP signatures could not be verified!
Error downloading sources: ncurses5-compat-libs
2. sudo gpg --recv-keys C52048C0C0748FEE227D47A2702353E0F7E48EDB
I've tried to add it manually but it didn't work.
3. sudo gpg --recv-keys 702353E0F7E48EDB
Also this one I've tried to add it manually but it didn't work
4. yay -S --noconfirm --needed ncurses5-compat-libs
5. Trying to fallow this forum
and least but not last
6. I've tried to clone the repository by hand by following
git clone http://aur.archlinux.org/ncurses5-compat-libs.git
cd ncurses5-compat-libs
sudo gpg --recv-keys C52048C0C0748FEE227D47A2702353E0F7E48EDB
makepkg -sic
cd ..
sudo rm -r ncurses5-compat-libs
And guess what, I'm back from where I started...
==> Verifying source file signatures with gpg...
ncurses-6.1.tar.gz ... FAILED (unknown public key 702353E0F7E48EDB)
==> ERROR: One or more PGP signatures could not be verified!
Error downloading sources: ncurses5-compat-libs
Dose any of you guys have any idea how can I fix this problem? If so let me know because I'm getting crazy already not been able to fix this.
You shouldn't need specifically ncurses5-compat-libs if you have a higher version of ncurses. Because version 6 is backwards compatible with version 5. You need to check whether you have libtinfo.so.6 or not. If you have it then you just need to create a system link. Check if you have libtinfo.so.6, so Run:
ls /lib/ | grep libtinfo
if you can't see libtinfo.so.6, you need to install ncurses (the current latest version of it: 6.2) and then create a system link that I mentioned below. so run:
sudo pacman -S ncurses
sudo pacman -S lib32-ncurses
if you have libtinfo.so.6 then run:
sudo link /lib/libtinfo.so.6 /lib/libtinfo.so.5
I went a step further from creating the link in the other answer here:
sudo link /lib/libtinfo.so.6 /lib/libtinfo.so.5
And created a dummy package so I could build something that depended on that being a thing:
$ cat /opt/aur/ncurses5-compat-libs-dummy/PKGBUILD
pkgname='ncurses5-compat-libs'
pkgver=6.1
pkgrel=1
arch=(any)
provides=('libtinfo5')
$ cd /opt/aur/ncurses5-compat-libs/dummy
$ makepkg -si
worked like a charm

Setup ICP 2.1.0 (IBM Cloud Private) fails due to ssh troubles. Single host installation under Ubuntu

When running
sudo docker run --net=host -t -e LICENSE=accept -v $(pwd):/installer/cluster ibmcom/icp-inception:2.1.0-ee install
I get fatal: [192.168.201.130] => Failed to connect to the host via ssh: Permission denied (publickey,password).
I have debugged the session:
root#icpecm:/opt/ibm-cloud-private-2.1.0/cluster# ssh -vvv -i cluster/ssh_key root#192.168.201.130
this is successful.
Have you copied the public key in all the nodes?
In your case:
$ ssh-copy-id -i .ssh/id_rsa root#192.168.201.130

Dockerfile for cloning private git repo

I'm trying to clone private git repository from github. I did a Dockerfile like this:
FROM ubuntu:12.04
RUN apt-get update
RUN apt-get install -y git
RUN mkdir -p /root/.ssh/
ADD ./id_rsa /root/.ssh/id_rsa
RUN git clone git#github.com:usr/repo.git
I use this repo with this key just fine locally, so it seems I'm missing something inside docker.
One more thing I may be missing is that both ~ and $HOME inside docker point to / instead of /root, but I'm not sure if that can be related.
What's the output of the build process?
Random guess: try to chmod 600 the private key.
If it still doesn't work, try to RUN ssh -v git#github.com (after adding the key); the output should explain what's happening.
RUN ssh-keyscan github.com >> ~/.ssh/known_hosts
The keyscan works great since it accepts the host. The following complete answer worked:
RUN mkdir -p /root/.ssh
RUN cp /var/my-app/id_rsa /root/.ssh/id_rsa
RUN chmod 600 /root/.ssh/id_rsa
RUN ssh-keyscan github.com >> /root/.ssh/known_hosts
Also as mentioned:
RUN ssh -v git#github.com
^ Great way to debug the flow. That's how I realized I needed the keyscan >> known_hosts
(Will probably not fit your needs)
There is another approach: https://stackoverflow.com/a/29464430/990356
Go to Settings > Personal access tokens and generate a personal access token with repo scope enabled.
Now you can do git clone https://MY_TOKEN#github.com/user-or-org/repo
Pros:
very simple approach
token can be easily revoked
Cons:
if someone has access to the Dockerfile he has access to the token
To fix this, you can use an environment variable to store the token
Below approach is using https with Personal Access Token, and it works like charm.
ARG git_personal_token
RUN git config --global url."https://${git_personal_token}:#github.com/".insteadOf "https://github.com/"
RUN git clone https://github.com/your/project.git /project
Then, supply a docker argument as below.
docker build --build-arg git_personal_token={your_token} .
Basic idea is from https://medium.com/paperchain/fetching-private-github-repos-from-a-docker-container-273f25ec5a74