0

I have tried this python code to push to my repository. When I execute it, it says code push successful. But when I logged in to my BitBucket, I understood that it didn't push anything. Please help me resolve this issue. Thanks in advance.

from git import Repo,remote
from pathlib import Path


try:
    rw_dir = Path("C:/repos/Dev")
    repo = Repo(rw_dir)
    repo.git.add(update=True)
    repo.index.commit('COMMIT_MESSAGE from python')
    origin = repo.remote(name='origin')
    origin.push()
    print("code push successful")
except:
    print("couldn't push code due to an error")
deeksha
  • 17
  • 7

0 Answers0