Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go-git compatibility with git-credential-manager (GCM) #1075

Open
dineshkumar181094 opened this issue Apr 11, 2024 · 1 comment
Open

go-git compatibility with git-credential-manager (GCM) #1075

dineshkumar181094 opened this issue Apr 11, 2024 · 1 comment

Comments

@dineshkumar181094
Copy link

Hi team,

Wanted to understand if go-git is compatible with git credential manager.

I have a custom requirement where I want to use Azure Managed Identity to clone the repository.

As per the documention we need to inject an environment variable https://github.com/git-ecosystem/git-credential-manager/blob/main/docs/environment.md#macoslinux-29.

@pjbgf
Copy link
Member

pjbgf commented Apr 11, 2024

I don't think it currently supports git credential manager. But given that this is an API, you should be able to authenticate with AMI by implementing that yourself (pulling the creds from Azure via their SDK), and passing them on via CloneOptions.Auth:

r, err := git.PlainClone(directory, false, &git.CloneOptions{
Auth: &http.BasicAuth{
Username: username,
Password: password,
},
URL: url,
Progress: os.Stdout,
})
CheckIfError(err)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants