'How to use GitPython on Replit to do a push via Python script?
I wanna use Replit for pushing from a Python script into a Github repo of mine. On Replit I created an Python script and connected it with an Github repo.
If I do this locally than I just use my local path to the repo which I wanna push. How do I assign a path if I wanna do it on Replit?
Here is the code which I use to make a Github push from a Python script locally:
from git import Repo
PATH_OF_GIT_REPO = r'/here/is/the/path/to/the/file/which/I/wanna/push'
COMMIT_MESSAGE = 'comment from python script'
def git_push():
repo = Repo(PATH_OF_GIT_REPO)
repo.git.add(update=True)
repo.index.commit(COMMIT_MESSAGE)
origin = repo.remote(name='origin')
origin.push()
git_push()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
