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?
Asked
Active
Viewed 3,859 times
6
-
I have found that git integration on eclipse is poor. I recommend using something like [SourceTree](https://www.atlassian.com/software/sourcetree) or even the [git command line](http://git-scm.com) – hd1 May 25 '14 at 05:09
2 Answers
3
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

androidcodehunter
- 21,567
- 19
- 47
- 70
-
+1. That is the idea I was suggesting in my answer: once the submodule is added, it becomes a simple entry in your main repo. – VonC May 25 '14 at 12:32
1
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