How we can configure remote mirroring for a project using python

How to use remote mirroing to push repository

How we can configure python API to create remote_mirror for a project on one gitlab instance to another gitlab instance:

    • I was using remote_mirror.create method in python to create a remote mirror for a project and I am getting a 404 error. I run the following command:

source_proj.remote_mirrors.create({‘url’:source project repo URL’, enabled: True}

What are you seeing, and how does that differ from what you expect to see?*

  • Consider including screenshots, error messages, and/or other helpful visuals
    Following error occur when I executed the above command

GitlabCreateError Traceback (most recent call last)
in
source_proj.remote_mirrors.create({‘url’:‘https://gitlab.mana.ericssondevops.com/EDISGOE/software-gateway-pull.git’, ‘enabled’: True})

C:\ProgramData\Anaconda3\lib\site-packages\gitlab\exceptions.py in wrapped_f(*args, **kwargs)
287 return f(*args, **kwargs)
288 except GitlabHttpError as e:
289 raise error(e.error_message, e.response_code, e.response_body) from e
290
291 return wrapped_f

GitlabCreateError: 404: 404 Not Found

  • *What version are you on?

12.8.1-ee

Are you using self-managed or The DevSecOps Platform | GitLab

  • Self Managed
  • What troubleshooting steps have you already taken? Can you link to any docs or other resources so we know where you have been?

I referred the python documentation, link and tried to use the method. In Pyhton i am using API Verison : 4 to connect to Gitlab instance.

Even when I tried to follow the gitlab documentation on gitlab_doc and try to execute the command on CLI i got the same 404 error .

Thanks for taking the time to be thorough in your request, it really helps! :blush: