last day (15 days later) » 

8:07 AM
0
Q: Error: “git: 'submodule' is not a git command” on Ubuntu 18.04.4 LTS and git 2.18.1

Pe DroI am trying to use git submodule with git but on running $ git submodule update --init --recursive I get git: 'submodule' is not a git command. See 'git --help'. I cannot find a solution online other than this question Error: “git: 'submodule' is not a git command” on Intel Edison and git...

 
Is your goal specifically to build git from source in such a way that git submodule works? I ask this because the build of git officially packaged for Ubuntu 18.04 LTS (provided by the git package) has a working submodule command. If there's a reason you can't use that (or prefer not to), you may want to edit this question to include information about that.
 
No, my purpose is to use the submodule functionality of git...irrespective of how git is installed
@muru I had done that previously but that didn't work too
 
@PeDro When you installed git from using apt, did the problem appear to be exactly the same as it does now, or were there any (even slight) differences? Also, what's the complete and exact output of type -a git and git --version? (I recommend making another edit to provide this information.)
 
Right now (after making from source), it shows git version 2.18.1
 
type -a git is really the more important command, since it reveals where the git binary is that's actually being run, as well as whether or not there appear to be other installed git binaries in other locations.
 
8:07 AM
Yeah, you were right. There is another git flavour installed. I see git is /home/.../linux-devkit/sysroots/x86_64-arago-linux/usr/bin/g‌​it But it doesn't have a uninstall rule.
 
Yeah, it looks like I was mistaken in thinking git could be uninstalled with make uninstall after being installed with make install. Sorry about that! You should be able to uninstall it by figuring out what files it installed, but for now, I think you can work around the problem by ensuring that the directory that contains a properly working git executable appears in $PATH before any directories that contain broken (or otherwise inadequate) git executable. I'll overhaul my answer with information about this.
Hi.
If you can't put a directory like /usr/bin earlier in your $PATH than /home/.../linux-devkit/sysroots/x86_64-arago-linux/usr/bin -- for example, maybe you're relying on other executables being found first in that other bin directory -- then you could put a symlink to /usr/bin/git in some other directory that is earlier in your $PATH than that.
 
8:20 AM
I've updated my answer.
You may want to add all the information you've provided in comments to your question. Even if my answer does end up offering an effective workaround or solution, other people may have insights that lead to a better answer.
 
8:39 AM
I found the way to uninstall git.
And I re-installed git using apt-get method
It works now :)
 
Excellent! :)
 
I am going to approve your answer but before that, I would request you to re-edit it and make it specific to the "removing other git variants and re-installing git" part
That woud make it clear and concise for new readers
 
I'm definitely willing to edit my answer, but I'm not sure quite what the edit is that you're recommending.
 

last day (15 days later) »