1

I am just messing around, but I have a blank project in Gitlab. I have a Python script (well, ipython notebook). I would like the Python script to simply push any files in "C:/users/files" to the Gitlab project.

I cannot find any instruction on how to do this from the API webpage here - https://python-gitlab.readthedocs.io/en/stable/gl_objects/commits.html.

It looks to me like it is impossible to do this, but surely it is.

3
  • 2
    Why not just execute bash commands from python? Something like cd C:/Users/files && git pull origin master && git add * && git commit -m "whatever" && git push origin master Commented Feb 7, 2020 at 14:34
  • @JavierLópezTomás good idea; but ideally I'd like it to run in windows and Linux if possible. Commented Feb 7, 2020 at 14:39
  • A workaround would be a conditional depending on the OS stackoverflow.com/questions/1854/what-os-am-i-running-on Commented Feb 7, 2020 at 16:55

1 Answer 1

5

Push is not possible with API but only possible with Git protocol. You can use GitPython (depends on git as it runs git under the hood) or dulwich (doesn't depends on git as it implements Git protocol in Python).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.