- -bash: git: command not found
- Method 1: Double check the command name
- Method 2: Make sure the command is installed on your system
- Method 3: Make sure the path is set correctly
- git clone:command not found
- 3 Answers 3
- You must log in to answer this question.
- Linked
- Related
- Hot Network Questions
- Subscribe to RSS
- bash can’t find git command: No such file or directory
- 1 Answer 1
- Linux console: git command not found on x64 Cent OS [closed]
-bash: git: command not found
When you are running commands on Linux, Unix or Mac OS system terminals, sometimes you will encounter the command not found error. All users and systems are different and the issue could be a number of different things.
Some of the reasons why you are getting git: command not found could be:
- The command is misspelled (yes it does happen)
- The command or package isn’t installed on the system
- The location of the script or package is unknown
Lets go into detail on the different ways we can fix git: command not found.
Method 1: Double check the command name
We make mistakes as humans and can easily misspell words or commands. Maybe you accidentally hit an extra word or added an unneeded space in the command.
Method 2: Make sure the command is installed on your system
Linux and Mac OS systems come with a lot of most common and popular packages or commands installed by default, but there are some versions that might be slimmed down a bit due to size and performance.
If your system doesn’t have a package or command installed, your package manager will be able to find a suitable package for your machine.
To install git on Ubuntu Linux systems, you can try running the command:
To install git on CentOS or Redhat Linux systems, you can try running the command:
Or for newer CentOS and Redhat systems, you can use the new DNF (Dandified YUM) command:
To install git on Mac OS, you can try running the command:
Method 3: Make sure the path is set correctly
One of the most common mistakes is not setting the path for Linux or Mac OS packages. You need to let the shell prompt know the full absolute path of the script or add it to your PATH.
The PATH variable contains a list of directories with binary and executable files and commands. When you run a command, it checks to see if it exists in one of those PATH directories to run it.
To check the path or location of a command you can use the which command:
which ls to find the where the ls command is located.
which git to find where git is located.
If you want to run git anywhere on your system, then you need to add it to your PATH:
You can add your package or script into one of those directories.
Or you can add a PATH to another directory that already contains your executable:
In this tutorial, you have learned how to fix the git: command not found error.
If you found this help, please leave a comment below.
Related package errors
git clone:command not found
I want to install something. as I am running a command on my Linux is m getting this error. What should i do? git clone https://iffgit.fz-juelich.de/fleur/fleur.git If ‘git’ is not a typo you can use command-not-found to lookup the package that contains it, like this: cnf git
3 Answers 3
Do you have git installed?
You can check that by opening your terminal and typing:
If it shows Installed: (none) , it means git isn’t installed. You can install it by typing:
After installing it you can clone the repository.
You should have bionic-updates and the security repository enabled in your /etc/apt/sources.list then you will be able to install git through sudo apt install git
u need to install git first
If you’re on a Debian-based distribution, such as Ubuntu, try apt:
You must log in to answer this question.
Linked
Related
Hot Network Questions
Subscribe to RSS
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.
Site design / logo © 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA . rev 2023.7.13.43531
Ubuntu and the circle of friends logo are trade marks of Canonical Limited and are used under licence.
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.
bash can’t find git command: No such file or directory
I’ve been using git along with a project in order to have version control for quite some time now. But all of a sudden, it stopped working! I noticed that while pushing new changes, because I received this message:
/home/user/bin/git/bin/git: No such file or directory
Please locate git binary and add the path to it in your PATH variable in ~/.bashrc file, something like export PATH=
why would git be expected in a directory like /home/user/bin/git/bin/? why can’t you use the git as supplied by the linux distribution you’re using, which definitely will not install git into /home/user/bin/git/bin/ unless you explicitely asked it to.
you can use package manager to query files in packages — or you can use «which» to see directory from which an executable will be executed. if which gives no output, most likely git hasn’t been installed
no root could explain why git was installed in user dir. easiest would probably be to ask your admin to install it for you. from package repository of distribution, this requires very little effort.
1 Answer 1
It looks like you have a dead link to a local version of git (which you might have removed?) in your $PATH. Try which git or find / -lname /home/user/bin/git/bin/git to spot it.
As I commented in the initial post comments, the command which git doesn’t help! Its output starts with «which: no git in (. )», and I’m not allowed to share the rest. It is quite big though! And I don’t have permission to run the other command you gave me.
1. How do you invoke git to get the error in your question? 2. the second command tries to search the whole file system. Ofcourse you are likely not allowed to acces all folders, just dicard errors as in find / -lname /home/user/bin/git/bin/git 2>/dev/null
1. All git commands («git log», «git status») produce the following error: «bash: /home/user/bin/git/bin/git: No such file or directory». 2. This command produces no output at all.
a different thought just occurred to me, did you check that there is no symbolic broken link at /home/user/bin/git/bin/git or, guessing from the weierd path, at /home/user/bin/git ? i.e. could you find /home/user/bin/ -iname «git» and check wether the results are symbolic links to no longer existing files? I would recommend to just delete your whole local version of git rm -rf /home/user/bin/git and ask your admin to install the package, anyway.
It turns that my admin actually removed git accidentally. The problem is now solved! Thanks for your help!
Linux console: git command not found on x64 Cent OS [closed]
I have a completely fresh install of 64 Bit Cent OS 5.7, this is in VirtualBox on top of 64-bit XP. I’m trying to install SSU. Problem: The command ‘git’ was not found. See «code» below please. Have tried looking this up: /usr/local/git/ does not exist: git: command not found (on OS X 10.5) I don’t care about source code: I just want git to work so SSU will install so I can try to access the bank on what seems like a huge whim. I am signed in to Gnome as root and seem to be able to access my computer normally without being harassed about passwords excessively and can create or edit files.
[root@localhost ~]# $ git clone https://github.com/wesabe/ssu bash: $: command not found
Concerns Unfortunately every single time I ask these kinds of questions and don’t make clarifications I end up having to make those clarifications. So. No negativity or rudeness intended what-so-ever: if the answer involves editing a text file or copy-and-paste actions please tell me the locations to do so in the file manager instead of console commands. I’m perfectly okay copying and pasting console commands for things that really should be done in the console though. Note: there appear to be numerous «git» commands and numerous «ssu» commands. I do NOT know the difference between them and would really prefer someone who has solid expertise to answer so that I nor others end up accidentally trashing our copies of Linux as it’s been very difficult to get anything to work and stay working thus extending my personal stay with XP. I will be more than happy to both accept an answer and thumbs it up should it be helpful.