I cloned an android project from github. I made changes after cloning and pushed it to the main repository from android studio. Everything worked fine but when I add an external library in my project I can't push it. I think its a sub module. Could anyone tell me how to push external library as a sub module from android studio?
After searching internet I found a simple way to do it. To add a sub-module we need to run this command
git submodule add LIBRARY_URL
and to init the sub module locally
git submodule update --init --recursive
If it is a submodule, you should be able to list the gitlink entry, special mode 160000
$ git ls-tree HEAD mysubmodule
160000 commit c0f065504bb0e8cfa2b107e975bb9dc5a34b0398 mysubmodule
It should also be recorded in your main repo/.gitmodules
file.
In that case, all you need to do is add and commit that entry, and push it.
If it is not, then remove that folder, and add it again as a submodule through command-line (instead of Eclipse/Egit)
git submodule add /url/of/library/repo mysubmodule
git add mysubmodule # no trailing / here)
git commit -m "Add a submodule"
git push toAndroidRemoteRepo
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