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

Problem with enabled 2FA on local GitLab instance #20

Open
hirnschmalz opened this issue Jul 27, 2018 · 7 comments
Open

Problem with enabled 2FA on local GitLab instance #20

hirnschmalz opened this issue Jul 27, 2018 · 7 comments

Comments

@hirnschmalz
Copy link

hirnschmalz commented Jul 27, 2018

Hi there,

I've problems with (I guess) 2FA enabled accounts. The following error message occures while trying to push:

ERROR - Unable to sync repo https://github.com/TYPO3/TYPO3.CMS.git -> https://git.custom-domain.tld/mirror-test/TYPO3.CMS.git (Command "git" "push" "--mirror" "https://git.custom-domain.tld/mirror-test/TYPO3.CMS.git" failed with exit code: 128, Stderr: fatal: could not read Username for 'https://git.custom-domain.tld': terminal prompts disabled

Maybe the reason is the slightly different username/password handling with enabled 2FA?

I'm using the docker image.

@bachp
Copy link
Owner

bachp commented Jul 27, 2018

Have you tried using SSH instead of HTTP to push to your instance?

@hirnschmalz
Copy link
Author

Our local git instance does not allow SSH.

@bachp
Copy link
Owner

bachp commented Jul 27, 2018

Currently to only way to push to HTTPS is to include the credentials in the URL:

git-mirror -u https://user:[email protected]/

I haven't tried this tough. Let me know if this works.

@hirnschmalz
Copy link
Author

This does not work, since this is only used for fetching the repositories inside the group. As far as I can see the URL for pushing is fetched via the GitLab API.

For now I will add .gitconfig and a .git-credential file with the required information.

@bachp
Copy link
Owner

bachp commented Jul 27, 2018

If you get it working it would be nice if you could write a quick howto that can be included in the README.

@hirnschmalz
Copy link
Author

Hi @bachp ,

there are two things I had to do

So as far as I can see to make git-mirror working with GitLab 2FA enabled the docker image must respect two new Environment variables

  • one two tell that 2FA is enabled
  • if 2FA is enabled a username must be provided

With this Information it should be possible to make everything working even if 2FA with http only access.

Markus

@bachp
Copy link
Owner

bachp commented Jul 30, 2018

I need to give it some more tought how this could be improved.

One idea would be to set GIT_ASKPASS and write a small helper that provides the credentials to git from config or environment variables.

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

No branches or pull requests

2 participants