Git bash win32exception: Failed to write credentials - eclipse

I've recently started using GitHub but for some reason every time I attempt to pull or push it asks for my credentials. I'm 100% sure I have my credentials correct but git bash keeps giving this error:
fatal: Win32Exception encountered.
Failed to write credentials
I don't know why but it does work every time I reinstall git bash up until my next reboot.
Please ask for any information you might need because I'm still quite unfamiliar with git.

Check if you have set a credential helper with git config -l|grep credential
On Windows, you should make sure you have:
git config --global credential.helper manager
With recent Git for Windows, that does use the Microsoft Git Credential Manager, linked to the Credential Manager in Windows.

Related

the application requires one of the following versions of the .net framework. how to solve this for github?

enter image description here
when i am trying to push any project to github this error shows. Can anybody help?
In this case, you're trying to use Git Credential Manager Core, which is a credential helper that's commonly installed on Windows. This program is written in C#, which means that you need to have .NET installed.
You have a couple options in this case:
Install .NET as prompted.
Change to a different credential helper by running git config --unset-all credential.helper && git config credential.helper wincred (which would change you to wincred. When prompted for your username, enter it, and then when prompted for your password, enter a new personal access token.
Switch to SSH by using git remote set-url origin SSH-URL, where SSH-URL is the SSH version of your URL. If you haven't generated an SSH key and uploaded the public portion to GitHub, you'll need to do that.

Integrating GIT repository with Jenkins

When I am trying to give the Git URL in Jenkins source code management, I am getting this error:
Failed to connect to repository : Error performing command: git.exe ls-remote -h https://github.com/shivnathr/DevOPS1 HEAD
How can I avoid it?
Make sure your Jenkins is running as your account, and not as a service with a technical account.
That way, Jenkins will benefit from the same configuration as your account.
But first, check if you can, with your account, in a simple CMD shell session, execute that same command successfully:
git.exe ls-remote -h https://github.com/shivnathr/DevOPS1 HEAD
When you configure this in Jenkins, it gives this error. But if you ignore this error, does it then work for the build? Have you configured git tools in Jenkins? I am not sure if having git in the path for the user running Jenkins will work (it might), but if you configure a git tool, it should use the first tool in the list to find git. BUT, if the first tool is set to auto-install, then this problem can occur. Make sure the first git tool is just pointing to an installation on the machine. I believe this is a bug. I found this on one of my installations, but I have yet to open an issue for it.

LFS: Git credentials for..XXXX..not found. Your user name must be of the form DOMAIN\user

So we are trying to setup GIT LFS with on premises TFS and we are having a couple of errors. The errors and setup are described below:
Setup:
1) On-premises TFS 2017 w/Update 1
2) Visual Studio 2015 w/Update 3
3) Atlassian SourceTree (Git Client)
4) GIT LFS is installed on the developer's system
5) The Git Credential Manager for Windows (GCM)
Errors:
Going to Tools->Options->[Git Tab] in SourceTree and selecting [Use System Git] and trying to checkout a version of the file from history results in the following error:
git-lfs/2.0.1 (GitHub; windows amd64; go 1.8; git 678cdbd4) git
version 2.12.1.windows.1
$ git-lfs.exe filter-process Error downloading object: Framework4.dll
(ef57f778c9fd50b27144784cd1df55b1b014d564ad6d8d726b156748219b8e5f)
Smudge error: Error downloading Framework4.dll
(ef57f778c9fd50b27144784cd1df55b1b014d564ad6d8d726b156748219b8e5f):
batch response: Your user name must be of the form DOMAIN\user. It is
currently USR123
Going to Tools->Options->[Git Tab] in SourceTree and selecting [Use Embedded Git] and trying to checkout a version of the file from history results in the following error:
git-lfs/1.5.2 (GitHub; windows 386; go 1.7.3; git 547a06aa) git
version 2.10.2.windows.1
$ git-lfs.exe smudge -- Framework4.dll Error downloading object:
Framework4.dll
(ef57f778c9fd50b27144784cd1df55b1b014d564ad6d8d726b156748219b8e5f)
Smudge error: Error downloading
ef57f778c9fd50b27144784cd1df55b1b014d564ad6d8d726b156748219b8e5f: LFS:
Git credentials for
http://localhost:8080/tfs/DefaultCollection/Common/_git/Common%20References
not found.: LFS: Git credentials for
http://localhost:8080/tfs/DefaultCollection/Common/_git/Common%20References
not found.
What I have researched and tried:
Folks recommended using "The Git Credential Manager for Windows (GCM)" to store and manage credentials. This was installed with the latest git version. But the errors still persists.
Tried it without having installed "The Git Credential Manager for Windows (GCM)" still the error happens.
Updated Git versions to the latest. Tried git-lfs/1.5.2 and git-lfs/2.0.1. But no go.
Additional error info on the Environment:
ENV:
LocalWorkingDir=C:\Users\USR123\Documents\GitCloneTest\Common\References2
LocalGitDir=C:\Users\USR123\Documents\GitCloneTest\Common\References2.git
LocalGitStorageDir=C:\Users\USR123\Documents\GitCloneTest\Common\References2.git
LocalMediaDir=C:\Users\USR123\Documents\GitCloneTest\Common\References2.git\lfs\objects
LocalReferenceDir=
TempDir=C:\Users\USR123\Documents\GitCloneTest\Common\References2.git\lfs\tmp
ConcurrentTransfers=1 TusTransfers=false BasicTransfersOnly=false
BatchTransfer=true SkipDownloadErrors=false FetchRecentAlways=false
FetchRecentRefsDays=7 FetchRecentCommitsDays=0
FetchRecentRefsIncludeRemotes=true PruneOffsetDays=3
PruneVerifyRemoteAlways=false PruneRemoteName=origin
AccessDownload=ntlm AccessUpload=ntlm DownloadTransfers=basic
UploadTransfers=basic GIT_CONFIG_PARAMETERS='color.branch=false'
'color.diff=false' 'color.status=false' 'diff.mnemonicprefix=false'
'core.quotepath=false' GIT_DIR=.git GIT_LFS_PATH=C:\Program Files\Git
LFS GIT_PAGER=cat GIT_PREFIX=
Any ideas on how to fix the credential / authentication errors above?
Thank you.
This error comes from LFS extension if you have logged in to TFS without specifying domain name, and you are trying to push a large file.
Go to Control Panel\User Accounts\Credential Manager, Windows Credentials tab and remove credentials stored for TFS server.
When you git push again from command line, you will be prompted for your credentials. Specify your user name with the domain: DOMAIN\USER
Since version 2.4.0 Git-Lfs comes with NTLM support. With this you no longer need to use the basic authentication fallback by setting the credentials in the Windows Credential Manager and Git-Lfs should work out of the box with TFS on-prem.

Error message 'Authentication failed on the git remote'

I'm trying to push, pull, and whatever to my GitHub repository from Visual Studio Code.
I enter my username and password, but I'm getting the error:
Authentication failed on the git remote.
I just logged in on github.com with the same user/password.
I tried creating a personal access token, using it as a password, but I got the same error.
I believe I have found a solution to this problem. None of the solutions above worked for me. I think the root cause of this issue is that GitHub has ended support for password authentication on August 13, 2021. Instead a personal access token needs to be used.
The steps to solve this issue are as follows:
Create a personal access token on GitHub.com. Tutorial here
Go back to Visual Studio Code and open terminal. Type in the following command with your own user information:
git remote set-url origin https://<TOKEN>#github.com/<user_name or organization_name>/<repo_name>.git
In case you would like to follow a video guide, this one proved to be quite helpful.
I solved it by following Caching your GitHub password in Git.
The steps are as follows:
Download and install Git for Windows
Run Git Bash, 'cd' to the repository directory and enter git config --global credential.helper wincred
It happened to me after GitHub changed its policy on 13 August 2021 to authenticate using a personal access token (PAT) instead of a password.
I did these steps for myself. I am on Lubuntu 20.04.
Created .gitconfig in my home directory and added the following
[user]
name = {your github username}
email = {your email}
[credential]
helper = store --file ~/.git-credentials
Created .git-credentials in my home directory as you can see above and added the following
https://{your github username}:{your github PAT}#github.com
Final step: Restart your terminal and voilĂ ! Try to commit/push/pull in an existing Visual Studio Code Git folder and everything will work as before.
Security Issue
Your personal access token (PAT) will be exposed as clear ASCII text and can be read if anyone has access to your user account.
I had the same issue with my Visual Studio Code on Linux cloning a Visual Studio Git repository.
It was Solved by setting up the Alternate Authentication Settings under security settings on {your-account}.visualstudio.com
Screenshot:
Configure VS Code Github authentication using Github CLI, gh.
Download and install gh here
After installation, open vs code terminal and login to github with gh auth login
You'll be prompted to choose an authentication method. Available authentication methods are password and personal access token. I'd recommend using a personal access token because your authentication details will be stored in plain text on your local machine. Here is a tutorial on creating a personal access token. You can then generate a personal access token here. Ensure your personal access token have the minimum required scopes repo, read:org, workflow
Paste your personal access token and gh will handle the rest.
If you've gone through the above steps before but your personal access token has expired, you can simply generate another personal access token and paste inside the /home/<user>/.config/gh/hosts.yml file. Note that this file path is for linux/MAC users. Windows users should be able to locate similar path in their filesystem.
In case of using VSCode git graph's buttons that result in message error like this:
Unauthorized fatal: Authentication failed ... unable to fetch from remote(s)
This worked for me:
git remote set-url origin "<the git you want to clone/pull/fetch>.git"
Enter your email & password in VSCode pop-ups
Now you can use git graph or cmd normally again
git remote set-url origin https://USUARIO:SENHA#bitbucket.org/URL.git
worked for me!
I faced a similar problem. I was coding in vs code. So, I just tried another terminal to push my code and it works for me!!

Git command line push rejected while accepted from Eclipse

I have set up and configured git on my computer, copied the public key to the server.
My problem is that if I try to clone, push, etc using command line commands I get rejected: Permission denined (publickey).
In the meanwhile if I do the same using Git Repositories view in Eclipse, everything works against the same repository.
My understanding was that git command line and Eclipse Git uses the same configuration.
Anybody has suggestion why I get rejected from command line?
Thanks