ezbz / gitlabber

Gitlabber - clones or pulls entire groups tree from gitlab
MIT License
472 stars 78 forks source link

Doesn't pull code into repositories #82

Closed Aruyna closed 2 years ago

Aruyna commented 3 years ago

I try clone all projects in my groups. Gitlabber finishes successfully and creates a hierarchy of groups and projects (folders) but they are empty (no code, no projects structures).

Command: gitlabber -t [token] -u http://git... -r C:\Projects -n path

StudyExchange commented 3 years ago

Me too。 My operating system is win10, and python==3.6.10, gitlabber==1.1.8

Planche95 commented 3 years ago

Same here, tool is useless at the moment

ezbz commented 3 years ago

can you please run the command in verbose mode and provide the output? I never tested this tool on a windows OS and unfortunately don't have access to one so I would love some help on debugging issues with it

jmkloz commented 3 years ago
2021-07-12 11:52:42,936 - gitlabber.git - DEBUG - Error cloning project <project>
Traceback (most recent call last):
  File "c:\program files\python39\lib\site-packages\gitlabber\git.py", line 78, in clone_or_pull_project
    git.Repo.clone_from(action.node.url, action.path)
  File "c:\program files\python39\lib\site-packages\git\repo\base.py", line 1111, in clone_from
    return cls._clone(git, url, to_path, GitCmdObjectDB, progress, multi_options, **kwargs)
  File "c:\program files\python39\lib\site-packages\git\repo\base.py", line 1049, in _clone
    finalize_process(proc, stderr=stderr)
  File "c:\program files\python39\lib\site-packages\git\util.py", line 370, in finalize_process
    proc.wait(**kwargs)
  File "c:\program files\python39\lib\site-packages\git\cmd.py", line 447, in wait
    raise GitCommandError(remove_password_if_present(self.args), status, errstr)
git.exc.GitCommandError: Cmd('git') failed due to: exit code(128)
  cmdline: git clone -v <project>
  stderr: 'Cloning into <project>...
ssh_exchange_identification: read: Connection reset by peer

I was able to solve the issue by removing the passphrase from my ssh key

ezbz commented 3 years ago

Checking this error GitCommandError(remove_password_if_present(self.args) I got to this issue I upgraded GitPython to it's latest version and released 1.1.9

jaronaz commented 2 years ago

Still having this issue with 1.1.9, upgraded to latest GitPython (3.1.20). raise GitCommandError(remove_password_if_present(self.args), status, errstr)

Have used method=http instead of default ssh and then it works (after providing credentials)

ezbz commented 2 years ago

can you please run

export GIT_PYTHON_TRACE='full'

and run your command with --verbose flag and post the full command you are running and the full output?

jaronaz commented 2 years ago
2021-08-30` 09:17:25,745 - git.cmd - DEBUG - AutoInterrupt wait stderr: b"Cloning into './test security/test-Angular-Dist'...\ngit@gitlab.com: Permission denied (publickey,keyboard-interactive).\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.\n"
2021-08-30 09:17:25,745 - gitlabber.git - DEBUG - Error cloning project ./test security/test-Angular-Dist
Traceback (most recent call last):
  File "/Users/name/.pyenv/versions/3.7.4/lib/python3.7/site-packages/gitlabber/git.py", line 78, in clone_or_pull_project
    git.Repo.clone_from(action.node.url, action.path)
  File "/Users/name/.pyenv/versions/3.7.4/lib/python3.7/site-packages/git/repo/base.py", line 1121, in clone_from
    return cls._clone(git, url, to_path, GitCmdObjectDB, progress, multi_options, **kwargs)
  File "/Users/name/.pyenv/versions/3.7.4/lib/python3.7/site-packages/git/repo/base.py", line 1059, in _clone
    finalize_process(proc, stderr=stderr)
  File "/Users/name/.pyenv/versions/3.7.4/lib/python3.7/site-packages/git/util.py", line 385, in finalize_process
    proc.wait(**kwargs)
  File "/Users/name/.pyenv/versions/3.7.4/lib/python3.7/site-packages/git/cmd.py", line 446, in wait
    raise GitCommandError(remove_password_if_present(self.args), status, errstr)
git.exc.GitCommandError: Cmd('git') failed due to: exit code(128)
  cmdline: git clone -v git@gitlab.com:test-security/test-angular-dist.git ./test security/test-Angular-Dist
  stderr: 'Cloning into './test security/test-Angular-Dist'...
git@gitlab.com: Permission denied (publickey,keyboard-interactive).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
ezbz commented 2 years ago

Judging from the error above this is a permissions issue and not a gitlabber issue, I found some indication that the issue might be with the OpenSSH installation on windows but I cannot test this,.

Another possible solution is to look into your ssh keys and try running the same command that gitlabber runs from the above output

git clone -v git@gitlab.com:test-security/test-angular-dist.git ./test security/test-Angular-Dist

and see if it succeeds

mmnaseri commented 2 years ago

As a tip to other people, this is most likely because your default clone setting is SSH and you haven't imported your SSH keys into your CVS