You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
"Exception Cmd('git') failed due to:" - not trigegring try:except #1583
I am preparing scrip that is meant to pull/checkout more repositories in different directories.
However, soemtimes can happen this:
Exception Cmd('git') failed due to: exit code(1)
cmdline: git pull -v origin
stderr: 'error: Your local changes to the following files would be overwritten by merge:
common_logic.py
git_jobs.py
svn_jobs.py
test_updating.py
updater.py
updater_core.py
updating_conf.py
updating_consts.py
Please commit your changes or stash them before you merge.
Aborting'
But when I try to put my code into try:except block, like this:
import git
try:
repo = git.Repo("/path/to/my/repo")
o = repo.remotes.origin
result = o.pull()
for item in result:
print("Item : {}".format(item))
except Exception as e:
print("Exception {}".format(e))
Nothing changes, the script still throws exception and fails. Is it possible to cover this case, and make it not to crash?
PS: Is it possible to make it, that it does not ask me for credentials every time? (like put them inside of my code)
Activity