How to place a created file in an existed GITLAB repository through python

I have created a text file using file operations in python. I want the file to be pushed to my existed GITLAB repository.

I have tried the below code where i get the created file in my local folders.

file_path = 'E:\My material\output.txt'
k= 'Fail/Pass'
with open (file_path, 'w+') as text:
    text.write('Test case :' +k)

What is the process or steps or any modifications in file_path to move the created text file to the GITLAB repository through python code.

Relevant tags