Cannot clone a repo from azure devops on Linux VM on windows 11 using ssh - linux

I am trying to clone a repo from Azure DevOps on Linux VM on windows 11 using SSH. It is asking me for a username and password for https://XX.visualstudio.com. The steps are below. Am I missing anything?
Created a VM Ubuntu 18.04 LTS using Hyper V
Installed git
Generated a key pair
added a public key in Azure DevOps
and git clone the repo
I was not able to create and edit ~/.ssh/config, it is not present, some solutions were suggested to edit it.

Please make sure we are using SSH URL when cloning.
Enter your passphrase for SSH key.
For more details about how to generate a new SSH key and set passphrase, you could refer to this doc: https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent

Related

Gitalb SSH into ubuntu server

in my local dev windows machine I generated shh key using PuttyGen. I also pasted public key into gitlab ssh keys section so now are linked.
I can correcty use ssh now from my windows manchine but I want to use it also in my production server which uses ubuntu.
For example I wan to ssh clone a repository into my ubuntu machine, where and how should I add the ssh keys to my ubuntu server so I can link it with gitlab.
I used this tutorial to generate ssh keys in windows with Putty.
https://ourcodeworld.com/articles/read/1421/how-to-create-a-ssh-key-to-work-with-github-and-gitlab-using-puttygen-in-windows-10
How should I add the ssh keys to my Ubuntu server so I can link it with GitLab?
Ideally, you would create a dedicated key pair on your Ubuntu server, in order to be able to clone GitLab repositories.
On that Ubuntu server, go to your $HOME folder of your account 'user' (replace user by the actual user name you are login with on that server).
cd
# assuming you do not have a default key yet:
ssh-keygen -t rsa -P "" -f ~/.ssh/id_rsa
# copy ~/.ssh/id_rsa.pub to your GitLab account
# Check the key is working
ssh -Tv git#gitlab.com
# Use your key to clone repositories
git clone git#gitlab.com:me/myRepository

Git not storing credentials when sshed into server

I have a ubuntu VM which I SSH into from a windows machine to develop on. I have my windows pub key on the linux VM so I can ssh without password.
On the linux machine I have set to store my git credentials. When I do any git command on the VM directly, it is able to use the stored credentials and carries out the given task. However, if I ssh into the VM from windows, and try to do any git command, it never stores the credentials and each time I have to reenter the password.
What is causing this and is there a way to fix it?
Compare the output of git config --show-scope --show-origin credential.helper when:
you are logged in directly on the Linux server
you are logged in through SSH from Windows
This assumes that, in both instances, you are using an HTTPS URL from your Linux server when using git clone/push/pull to a remote server.
If the Git on Linux is not recent enough, use simply git config --global credential.helper.

How to configure users/keys to allow Ansible to run against multiple hosts?

I'm currently using a sandbox environment to help gain an understanding of Linux and Ansible.
I have a rhel 7.6 VM where Ansible is installed/ran from that i connect to via moba. I then have 2 test VMs that i'd like to run Ansible against.
I cannot SSH from the Ansible VM to either of the test VM's (Permission denied public key) but i can connect directly to the test VM's.
How do i set up the keys/hosts? does the private key need to be uploaded to the Ansible VM?
Try to deploy ~/.ssh/id_rsa.pub key from Ansible control machine to one of your VM's in a file ~/.ssh/authorized_keys. Copy the contents of ~/.ssh/id_rsa.pub from the Ansible control machine in ~/.ssh/authorized_keys on the target host. You may use the ssh-copy-id command to perform this for you so long as you have access to the target host via some method.
another method different from best practice id_rsa.pub deployment is configuring inventory vars for your hosts/groups by setting ansible_user, ansible_ssh_pass (with vault usage), ansible_become_user, ansible_become_pass (with vault usage)

gitlab error - the remote en hung up unexpectedly

I installed Gitlab on my Ubuntu successfully(gitlab.domain.com), on a client PC I installed Git (windows 7), then run Git Bash to generate SSH keys with command: ssh-keygen -t rsa -C "username#domain.com" to create private/public keys on C:\Users\AccountName.ssh
Then, add public key to profile on installed gitlab. Then can clone/push on Git Bash.
However, I can not reproduce this on other PCs, I tried some PCs, created new users, new ssh keys...
but always encounter that error "The remote end hung up unexpectedly", sometimes can clone but also get that error when pushing.
I can only clone/push on first PC. I'm so confused, don't know what I missed. I'm trying to get my team on Git
Thanks a lot for any advice
Make sure you are pointing it at the correct git server. Also - login on your Jenkins server (Under the jenkins user) and ssh to git#your-git-server and make sure to select 'yes' to add the server to your known hosts.
I had the same error and it was an access-level problem :
my user only had guest access to my project so it wasn't able to clone it. I changed the access level to developper and it solved my problem

Clone TFS-GIT repository to GIT repository (Linux) by using GIT

We have Redhat Linux server, GIT was already installed on this server and we need to create a local repository.
We have TFS-GIT project in TFS 2015, we need to clone the TFS-GIT repository to the GIT repository on Linux by using GIT commands.
For this task, we created a empty local repository on Linux, and configured the basic authentication and configured the SSL certification by using server manager.
Still getting "Fatal: authentication error" to connecting TFS-GIT repository on windows server 2012 . We tried in different ways but still we are getting same error.
Am using my basic credentials like which I used for server logins and I have only id and password for everything.
Is there any specific kind of passsord I need to use for this?
Please advise me on this
Thanks in advance
You have done all as it should be.
You need to copy your public key of the desired user to the Unix server as well so it will work.
How to setup ssh-key?
# generate the key (local machine)
ssh-keygen -t rsa
# copy the generated key to your unix machine (server)
# the key is in : %HOME%/.ssh/id_rsa.pub
# In widows its under your user account: Users/<user_name>
Other ways
If you have only username and password you might need to use http/https.
Read here how to set it up/

Resources