cargo generate using ssh results in: Git Error: Failed to authenticate SSH session: ; class=Ssh (23) - ssh

I'm currently struggling getting cargo-generate to work properly with ssh.
Generating from github using https works fine.
I have no issues using git by itselve as well, but for some obscure reason cargo generate does not play nicely with it.
Here is the error I am presented with, after trying to clone a simple template of mine:
cargo generate git#github.com:VirtualNonsense/rust_bluepill_minimal_template.git
Using application config: C:\Users\VirtualNonsense\.cargo\cargo-generate.toml
Using ssh-identity from application config: $HOME/.ssh/id_rsa
Favorite git#github.com:VirtualNonsense/rust_bluepill_minimal_template.git not found in config, using it as a git repo url
Using private key: `%userprofile%\.ssh\id_rsa` for git-ssh checkout
Error: Git Error: Failed to authenticate SSH session: ; class=Ssh (23)
My cargo-generate.toml file consists only of the following lines:
[defaults]
ssh_identity = "$HOME/.ssh/id_rsa"
I've seen that there seems to be an issue with passphrase protected keys so I made sure mine does not have one. I also tied an ed25519 key but it did not change the result as well.
I feel like I'm missing something obvious and would appreciate some guidance😅

Related

Authentication for github on Dockerfile

In my Dockerfile I want to clone a repo from github. To achieve that I applied the following command to my Dockerfile:
RUN git clone -b docker https://<pat-token>:x-oauth-basic#github.com/<mygithubaccount>/<repository.git> /myfolder
Of course, the phrases in square brackets are placeholders.
When I build the image from my Dockerfile I can read authentication error in the output:
remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
I assume that is something around my authentication string. Maybe I cannot use a personal access token?
How do I correctly authenticate against github in my Dockerfile?
Fixed it - I've had a type in the token 🙈

Using Gitlab deploy keys with write access

I am currently running CE version 8.17.4 and am attempting to setup a deploy key with write access (as of 8.16) so that my runner instance may commit build artifacts back to the repository. I took the following steps to set this up:
On the runner instance, I generated the ssh keypair with the command: 
sudo ssh-keygen -t rsa -C "label" -b 4096
The generated keypair was saved to /home/gitlab-runner/.ssh/id_rsa and password protected.
Within Gitlab, I created a public deploy key from the admin console and pasted the contents of id_rsa.pub into the appropriate field and verified that the key fingerprints matched. I checked the "Write access allowed" box. 
In the private project that I wished to enable repository access from the runner, I enabled the newly created public deploy key.
This is a LaTeX document respository, so in the .gitlab-ci.yml file, I issue the following script after building the pdf:
after_script:
  - "git commit -am 'autobuild PDF'"
  - "git push origin master"
When the changes were committed, the build ran successfully on the runner up until the git push origin master command, and this error was thrown:
fatal: Authentication failed for 'http://gitlab-ci-token:xxxxxxxxxxxxxxxx#host/project.git/'
Ok. A couple questions:
If the deploy key is just an SSH key, shouldn't it be connecting on the secure port or does this matter? I haven't found much documentation on using this new write-permission deploy key feature, so am I missing something in the steps I took above?
Do I need to include [ci skip] in the commit message to avoid looping CI builds? I saw this concern come up in the original issue tickets for this feature, but did not see whether this step was required or not. 
Thanks for any help!
Jawad's comment worked for me: you need to force SSH. for example
git remote add ssh_remote git#host:user/project.git
git push ssh-remote HEAD:dev
thanks jawad

Pull a private repo as a dependency during a dokku deploy?

I am using Dokku on DigitalOcean to deploy my_app.
My app has a dependency which points to a private repo git#github.com:my_org/my_app.git.
Step 10 : RUN <some_command_to_install_deps>
---> Running in ceada9d96c61
* Getting my_repo (git#github.com:my_org/my_app.git)
remote: verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I've tried adding deploy keys using https://github.com/cedricziel/dokku-deployment-keys to no avail. Any help is greatly appreciated.
Along with the deployment keys plugin, you will also need the hostkeys plugin to add github.com to the container's known_hosts file. For example, to approve github.com across all applications on the machine, simply do...
Install the plugin...
dokku plugin:install https://github.com/cedricziel/dokku-hostkeys-plugin.git hostkeys-keys
Then run...
sudo dokku hostkeys:shared:autoadd github.com
If you still face issues after doing this, there is something wrong with your deployment keys setup. In that case, leave a comment and I'll help troubleshoot it

Unable to run jepsen test for either elasticsearch or rabbitmq

I seem to be missing something basic as I try to run the tests # https://github.com/abailly/jepsen-vagrant
Here is the output for the rabbitmq test profile in lein :
lein test :only jepsen.system.rabbitmq-test/rabbit-test
ERROR in (rabbit-test) (Session.java:512)
Uncaught exception, not in assertion.
expected: nil
actual: com.jcraft.jsch.JSchException: Auth fail
at com.jcraft.jsch.Session.connect (Session.java:512)
com.jcraft.jsch.Session.connect (Session.java:183)
clj_ssh.ssh$connect.invoke (ssh.clj:327)
jepsen.control$session.invoke (control.clj:182)
clojure.lang.AFn.applyToHelper (AFn.java:154)
clojure.lang.AFn.applyTo (AFn.java:144)
clojure.core$apply.invoke (core.clj:624)
jepsen.core$fcatch$wrapper__4829.doInvoke (core.clj:39)
clojure.lang.RestFn.invoke (RestFn.java:408)
clojure.core$pmap$fn__6328$fn__6329.invoke (core.clj:6463)
clojure.core$binding_conveyor_fn$fn__4145.invoke (core.clj:1910)
clojure.lang.AFn.call (AFn.java:18)
java.util.concurrent.FutureTask.run (FutureTask.java:266)
java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1142)
java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:617)
java.lang.Thread.run (Thread.java:745)
Ran 1 tests containing 1 assertions.
0 failures, 1 errors.
Tests failed.
Error encountered performing task 'test' with profile(s): 'base,system,user,provided,dev,rabbitmq'
Tests failed.
vagrant#jepsen:/jepsen/jepsen$
How can I fix this. I did all the steps mentioned for auth fix in both https://github.com/aphyr/jepsen/tree/master/jepsen and https://github.com/abailly/jepsen-vagrant steps...
Here are a couple of additional thing to check when working with code that uses jsch
make sure ssh-agent knows the password for the key you are using. Use ssh-add to do this.
use a key (ie ~/.ssh/id_rsa) for that host which does not have a password. Be sure to set this on the project explicitly. In this case the readme mentions setting it in the project config.
make sure you can ssh to the host using the same key manually by running "ssh -v -i ~/.ssh/id_rsa user#host " and read the output to make sure it's using the key you think it is.
add logging set the log level in your project for ’com.jcraft.jsch’ to debug and ensure that it's using the user you think it should be. This may be more or less practical depending on how your project has logging configured. I have often had jsch based projects try to use empty usernames.
try running the project from a different host with different key configurations to see if it's a local environment issue (usually in my experience related to ssh-agent)
And best of luck to you, every jsch based project breaks in it's own ways though the problems are almost always solvable.

Downloading CVS repository generates a server connection error

I have an "org.eclipse.team.internal.ccvs.ssh2..." error leading to a Connection Timeout downloading a CVS repository using extssh.
I have tried installing different versions of Eclipse, still the same Connection Timeout issue exists.
I can download other svn/git projects. Only this CVS repository has issues. I have checked my Java version and tried to pull the code using command line.
Screenshot showing the error:
When I tried to pull code from command prompt:
This looks like a firewall problem. Go to Preferences -> General -> Network connections to set your proxies, etc.
Also, the reason this won't work on the command line is that the extssh protocol is not defined for the command line. You should be able to use ssh or pserver (for anonymous access).