I have the following code in a Jupyter Notebook's cell:
!git push origin master
which will ask my password for Github but the cell keeps on running as I can't find the way to input my password. For some reason, I want to push the code this way.
I tried to follow the similar questions but nothing seems to be working in my case. Here's what I tried and it didn't work:
import getpass
import os
password = getpass.getpass()
command = "git -S push origin master " #can be any command but don't forget -S as it enables input from stdin
os.system('echo %s | %s' % (password, command))
Here's the log for above:
unknown option: -S
usage: git [--version] [--help] [-C <path>] [-c <name>=<value>]
[--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
[-p | --paginate | --no-pager] [--no-replace-objects] [--bare]
[--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
<command> [<args>]