How to Push files into GitHub from google colab ?

Navaneeth Kt
1 min readMar 28, 2019

Hi. I hope you are enjoying Google Colab as much as I do. I would like to share some tips to make Google Colab easier to use day-to-day. Here’s a convenient way to push files from google colab into GitHub. it’s very simple but I took a lot of effort in trying to solve this.

first, we have to initialize the git repository like,

!git init

then set the global username and email as follows

!git config — global user.email “You@Your.com
!git config — global user.name “Username”

Add all the files like,

!git add -A

then commit,

!git commit -m “first commit”

this is the most important line, when you add the git remote origin you need to pass your Github credentials with the URL like,

!git remote add origin https://<username>:<password>@github.com/<username>/reponame.git

at last, push your awesomeness

!git push -u origin <branch>

Troubleshooting:

if you got “fatal: remote origin already exists” error try running this command

!git remote rm origin

Thanks for reading —

--

--

Navaneeth Kt

navaneeth@lisa:~$ Deep learning dev \ full stack dreamer \ nyctophilist