How to skip password typing for Git against Kerberos? - linux

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.

Related

Gitlab: How to git pull without credentials?

I have generated an id_ed25519 key on my server and set it in Gitlab, when I try to connect with SSH, I get the welcome message, but when using git pull, it's still requiring credentials (username and password).
$ ssh -T git#gitlab.com
Welcome to GitLab, #john.doe!
$ git pull
Username for 'https://gitlab.com': john.doe
Password for 'https://john.doe#gitlab.com':
Already up to date.
What's missing in my configuration ?
I guess it would be because you are using https git remote url instead of ssh one.
Please check your configured remote, it should be the https one:
$ git remote -v
origin https://gitlab.com/john.doe/myproject.git (fetch)
origin https://gitlab.com/john.doe/myproject.git (push)
You'll want to change it to the SSH one:
$ git remote set-url origin git#gitlab.com:john.doe/myproject.git
This does what OP mentioned in the comment of the accepted answer, without having to manually edit the config file. Please upvote the accepted answer before mine :)

git pull with access token, git push with username / password

I've got a problem with git push. Here are many threads regarding this issue, but none of them fit to my problem.
The company I work for, has it's own gitlab. Policy is only https, no ssh is allowed. For cloning and pulling, an access token is required. Pushing only with username/password. Don't ask me about the underlaying reason. Unfortunately I don't know it.
Error message is:
$ git push
fatal: unable to access 'https://<username>:<AccessToken>#<domain>/<owner>/<reponame>.git/': The requested URL returned error: 403
At least I alread was able to clone a repo, but I'm failing to push the changed content respectively. Ubuntu 18.04 is running on my laptop.
What do I need to do to solve my issue?
You already know that every remote stores a URL: origin literally means https://<username>:<AccessToken>#<domain>/<owner>/<reponame>.git/.
What you didn't know is that every remote actually stores two URLs. One is used for git fetch, and the second one is used for push. The second URL defaults to being the same as the first URL, but if you set it, you can set it to anything else, such as the URL without the access token. To set the second URL, you can use git remote set-url --push:
git remote set-url --push origin <url>
If you're like me, you might want to know about git config --edit as well, which will open the configuration file (typically just .git/config) in the same editor you're having Git use for everything else, where you can just edit it directly. But git remote is the tool designed for fiddling with the settings attached to each remote-name.

Git requires username and password for git push, git pull using HTTPS method

So, when I use HTTPS method for cloning git repository and do some changes and push or pull to git it will always be prompting me for username and password. what's the solution for that?
Apart from changing to SSH, you can also keep using HTTPS, if you don't mind to put your password in clear text. Put this in your ~/.netrc and it won't ask for your username/password (at least on Linux and Mac)
Make one .netrc file in your home directory.
machine github.com
login <user>
password <password
The solution to your problem is this git command which is kind of remember me of GIT.
git config credential.helper store
Read this for details:
GIT credentials store

Git: How to change password of credentials used to clone a repository

I am working on linux and I clone a private repository using my github account credentials. But over the period of time my password has changed for github and whenever I try to use git pull it is giving me an error
remote: Invalid username or password.
How can I change the password which I used while cloning the repository for the first time?
You the issue an git remote -v and check what kind of auth you are using. I always use git protocol (which uses SSH). You can freely edit those remote urls in ./git/config file. I believe you cloned it using HTTP (or using SSH w/o .ssh key file being present).
If you want to use SSH, you can follow this: https://help.github.com/articles/generating-ssh-keys
Then you will never need to worry about passwords again.

git-svn rejected Basic challenge now that VPN is required

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

Resources