git-svn rejected Basic challenge now that VPN is required - linux

I have been using git-svn for a few months now as an interface to the SVN repository for my company.
However, about a week ago my company changed their policy such that SVN is only reachable if connected by way of Cisco VPN.
I have no trouble connecting to VPN on my Linux Mint VM (which is where I do my coding), but I am now no longer able to pass authentication when I, for example, run git svn dcommit to checkin code changes.
I have tried:
rm -rf ~/.subversion, to get rid of any saved SVN authentication credentials and force it to take new ones, but this seems to have no effect, nor does it ever prompt me for fresh credentials, surprisingly.
starting in a freshly created directory and running git svn clone to initiate a new link to the SVN repository, but with the same authentication failures.
Here is what I see when running git svn dcommit or git svn clone:
$ git svn dcommit
Committing to https://<redacted>:2443/svn/LS/branches/PRODUCTION-SUPPORT-1/ls-policygen ...
WARNING: gnome-keyring:: couldn't connect to: /tmp/keyring-wCQwzG/pkcs11: No such file or directory
Authorization failed: OPTIONS of 'https://<redacted>:2443/svn/LS/branches/PRODUCTION-SUPPORT-1/ls-policygen': authorization failed: Could not authenticate to server: ignored NTLM challenge, rejected Basic challenge (https://<redacted>:2443) at /usr/local/libexec/git-core/git-svn line 943
The gnome-keyring warning has always been present, and never stopped commits before VPN was required.

take a look at this snipped from your error code:
Authorization failed: OPTIONS of 'https://<redacted>:2443/svn/LS/branches/PRODUCTION-SUPPORT-1/ls-policygen': authorization failed: Could not authenticate to server: ignored NTLM challenge, rejected Basic challenge (https://<redacted>:2443) at /usr/local/libexec/git-core/git-svn line 943
specially at this part: Could not authenticate to server: ignored NTLM challenge
It looks like your company also changed autentication methods too.
Take a look at: Does git clone work through NTLM proxies?
I would take this steps:
connect to your repository within your browser
try to connect with another user account - probably you have some cache files in your home directory
configure git or even svn according to NTLM auth
Good Luck,
LEslie

Related

How to skip password typing for Git against Kerberos?

I have a problem with git clone from TFS. Client is Ubuntu 14.04,
TFS certificates are available because https works properly. Proxy is unset in Git and global env.
Working scenarios:
A. git clone https://url.to.my.tfs/
B. git clone https://user#url.to.my.tfs/
A. requests username and password, type them, all proceed good.
B. Git don't request a password. Cloning is proceed good. So communication linux(git)-kerberos(TFS) is already OK.
Modified A.) pressed Enter when git request for username and password I get:
fatal: Authentication failed for https://url.to.my.tfs
So, where is the problem? How to skip password typing?
fatal: Authentication failed for... is exactly because of that you didn't type user/pass when requested.
And git clone https://user#url.to.my.tfs/ and no password requests from Git can be because of Git credential.helper cache used on HTTPS protocols.
https://git-scm.com/book/gr/v2/Git-Tools-Credential-Storage
This answered question relates to HTTPS on Github but it also applies to your scenario. Is there a way to skip password typing when using https:// on GitHub?
There you can find option that suits you best.

Not able to access git repo from jenkins

I have configured Jenkins on a Linux machine and my git repo is on an another Linux server. But when I try to give the URL of the repo to Jenkins I get the following error.
Failed to connect to repository : Command "git -c core.askpass=true ls-remote -h ssh://user#ip/~/export1 HEAD" returned status code 128:
stdout:
stderr: Permission denied, please try again.
Permission denied, please try again.
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
What could be the cause for this?
I have seen that both the systems' rsa key is present in each other's .ssh/known_hosts folder.
I am able to pull or clone code from the repo to a folder in Jenkins system as well. So why is Jenkins not able to take it?
I have also tried the URL user#ip:/fullpath/to/repo
You need to make sure Jenkins is running as the right user (the one who has the keys in ~/.ssh/id_rsa(.pub)
That user might not be the same as the one used in the ssh url: user#ip means you are connecting to ip using an account which has your public key in ~user/.ssh/authorized_key.
So the Jenkins process must be run by an account which has the private and public key, whose public key is in ~user/.ssh/authorized_key on the git server side.
And that account should have done (only once) an ssh-keyscan -H ip >> ~account/.ssh/known_hosts before any ssh attempt, in order to record the git server ip as a known host.
Does it being a bare repo make any difference or change in the URL?
No. The .git at the end of the bare repo folder is optional when used as an url.
Further to #VonC's reply, you can also use the Credentials plugin to define a set of credentials on your Jenkins master that your Jenkins job uses to access your Git repo. This allows you to run Jenkins itself as a different user from there one that has access to the Git repo.
The main problem was the security of the systems. I hadnt checked the authentication mechanisms on my server. The password authentication to the git server was causing the problem because the jenkins machine tries to directly fire a ls-remote to the path. When you do the same thing on the terminal you will be prompted for a password and then itl accept. When I set the password authentication and UsePAM to no and enabled the RSA authentication, pubkey authentication and authorised key setting to yes in the sshd_config file, and restarted, it was able to access the repo and I dint get this error.

http 401.1 error while performing a GIT clone from a Linux server

I'm running TFS 2013 with a GIT team project. When I perform a git clonefrom one of the local Windows servers I don't have any issues:
-bash-4.1$ git clone "http://tfsadm:tfspas#tfs.server.com:8080/tfs/DefaultCollection/_git/Main"
Initialized empty Git repository in /home/tfsadm/Mainframe/.git/
but when I perform a git clone from Linux, I get the following error:
error: The requested URL returned error: 401 while accessing http://tfsadm:tfspas#tfs.server.com:8080/tfs/DefaultCollection/_git/Mainframe/info/refs fatal: HTTP request failed
Error: The requested URL returned error: 401 while accessing https://github.com/Joey-myproject/repo.git/info/refs fatal: HTTP request failed
is an often reoccuring error.
One of the reasons of this happening is because the client is not authorized to access to that resource.
A general solution is to check for the following:
Do you have a stable git version?
Is the remote correct configured?
If 2FA is enabled, if so provide an access token.
Double check your permissions(username/password in configs) perhaps also try to use the format ' https://username#mydomain.org/project.git''
Try ssh instead of https
I am not sure, but have you already seen this link Can't clone a github repo on Linux via HTTPS?
It can give some extra information.

How can I get git to work with a remote server?

I am the CM person for a small company that just started using Git. We have two Git repositories currently hosted on a Windows box that is our all-purpose Windows server. But, we just set up a dedicated server for our CM software on an Ubuntu Linux server named "Callisto".
So I created a test Git repository on Callisto. I gave its directory all of the proper permissions recursively. I had the sysadmin create a login for me on Callisto, and I created a key to use for logging in via SSH. I set up my key to use a passphrase; I don't know if that could be contributing to my problems? Anyway, I know my SSH login works because I tested it through puTTY.
But, even after hours of trials and head scratching, I can't get my Windows Git bash (mSysGit) to talk to Callisto for the purposes of pushing or pulling Callisto's git repository files.
I keep getting "Fatal error. The remote end hung up unexpectedly." And I've even gotten the error that Git doesn't recognize the test repository on Callisto as a git repository. I read online that the "Fatal error...hung up unexpectedly" is usually a problem with the server connection or permissions. So what am I missing or overlooking here? And why doesn't a pull using the git:// protocol work, since that only uses read-only access? Group and public permissions for the git repository's directory on Callisto are set to read and execute, but not write.
If anyone could help, I would be so grateful. Thank you.
If you use putty/pageant, check if your host is in the know_hosts file in
docssettings/userdir/.ssh
If not, try putty first and accept the key your server provides.
Do you have similar lines in .git/config?
[remote "origin"]
url = ssh://user#server/.../repo.git
I have only passing familiarity with mSysGit, but I don't think it installs an ssh client. Without the ssh client, git cannot connect to the server. (This functionality isn't baked into git as per the Unix philosophy.) As for the git protocol, unless the server has that enabled, it won't work. Since it seems you have the server setup for ssh access, I doubt you'll get anywhere with the git protocol.
Anyway, I know my SSH login works
because I tested it through puTTY.
Have you confirmed that you can SSH to the server from your msysgit client?
i.e. what happens when you ssh user#callisto.com from the msysgit command line?
For further details about setting up your git server, you may want to review Pro Git: Chapter 4 "Git on the Server".
And why doesn't a pull using the
git:// protocol work, since that only
uses read-only access?
For the git protocol to work, you must setup the git daemon on your server as described in Chapter 4.9 of Pro Git.
You may also want to take a look at this answer to a related SO question. It has a more detailed checklist of things to consider.

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