I cloned a public github repo of mine into my drive. I am able to use colab with the notebooks. I can also pull. I however face the following error when trying to push despite having correctly configurated:
!git config --global user.email "my_email"
!git config --global user.name "my_user"
When doing !git push origin master
I get the following error:
fatal: could not read Username for 'https://github.com': No such device or address
Has somebody encountered this problem before?
Here is how to clone, add a file, and push back
uname = "korakot"
!git config --global user.email '[email protected]'
!git config --global user.name '$uname'
from getpass import getpass
password = getpass('Password:')
!git clone https://$uname:[email protected]/korakot/myrepo
%cd myrepo
# create a file, then add it to stage
!git add hello.txt
!git commit -m 'commit message' # commit in Colab
!git push origin master # push to github
None of the options mentioned above worked for me. I finally found the answer in this Medium article. Basically, the key line that I was missing was:
> !git remote add origin https://<USERNAME>:<PASSWORD>@github.com/<USERNAME>/reponame.git
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With