How to get started with Git on Mac

I installed Git on my Mac, but I don’t know how to run it or get it. From the terminal, I type Git, but it says that the command is invalid.

I downloaded Git from http://code.google.com/p/git-osx-installer/downloads/list?can=3 and I downloaded the package "Git Installer 1.7.3.5 - OS X - Leopard - x86_64."

UPDATE 1:

The contents of the package are as follows:

  • README.txt
  • git -1.7.3.5-x86_64-leopard.pkg
  • setup Git PATH for non-terminal .sh programs
  • uninstall.sh

When I execute "setup Git PATH for non-terminal .sh programs," I get the following messages:

No change to PATH in ~ / .MacOSX / environment.plist
~ / Volumes / Git 1.7.3.5 x86_64 Leopard / Volumes / Git 1.7.3.5 x86_64 Leopard-MacBook-Pro: Git 1.7.3.5 x86_64 Leopard $$ PATH - bash: / usr / local / bin: / bin: / sbin: / usr / bin: / usr / sbin: / usr / libexec: No such file or directory

UPDATE 2:

The contents of my profile file are as follows:

# System-wide .profile for sh(1) if [ -x /usr/libexec/path_helper ]; then eval `/usr/libexec/path_helper -s` fi if [ "${BASH-no}" != "no" ]; then [ -r /etc/bashrc ] && . /etc/bashrc fi 
+17
git macos
Jan 18 2018-11-18T00:
source share
7 answers

The git -osx-installer that you used should have installed git in /usr/local/git . See if you can cd into this directory. If you can, check that PATH set correctly by running echo $PATH from the terminal and making sure that you see /usr/local/git/bin in the included PATH . If not, you need to add it to your PATH .

Did the included shell script setup git PATH for non-terminal programs.sh ?

Update 1: How to start an included shell script

  • Install the git -osx-installer disk image by double-clicking git-1.7.3.5-x86_64-leopard.dmg , which should be located in your Downloads folder.
  • Open terminal from /Applications/Utilities/Terminal
  • Type cd /Volumes/Git 1.7.3.5 x86_64 Leopard/
  • Type ./setup git PATH for non-terminal programs.sh and press Enter to start the shell script. Note. After entering ./setup you can press the Tab key and it will be autocomplete for you.
  • Open a new terminal and enter echo $PATH
  • Confirm that you see /usr/local/git/bin in PATH.

Update 2: Show git Who is the Master

Open a terminal and run the following commands:

 echo "/usr/local/git/bin" > git sudo mv git /etc/paths.d 

When you run sudo, it will ask for your OS X password.

After issuing these two commands, you can open a new terminal window and see /usr/local/git/bin when echo $PATH starts.

To do this, you need to have the following in /etc/profile , which it does by default:

 if [ -x /usr/libexec/path_helper ]; then eval `/usr/libexec/path_helper -s` fi 
+21
Jan 18 2018-11-18T00:
source share

General introduction:

Git Dive is an excursion that goes through the basics of Git, inspired by the premise that you need to know what needs to be done.

+5
Jan 18 2018-11-18T00:
source share

Use MacPorts:

 sudo port install git 
+1
Jan 18 2018-11-18T00:
source share

Either '/ usr / local / bin' is not in your PATH, or simply does not find git ...

try it

 $ PATH='/usr/local/bin' $ export PATH 

RESTART DESIGN

try again - if it still does not work

  • check if the location / opt / local / bin / git or / opt / local / bin / github exists (depending on your version)

if so:

2. Type

 $ sudo ln -s /opt/local/bin/git /usr/bin/git 

or

 $ sudo ln -s /opt/local/bin/git /usr/bin/github (depends on your version) 

3. should work now

+1
May 27 '12 at 18:22
source share

It may be easier to create a symbolic link from one of the default paths:

 sudo ln -s /usr/local/git/bin/git /usr/local/bin/git 
+1
04 Oct
source share

Why not just run it directly? You can learn to tune it when you become more experienced.

Check if git can be run to see the installed version

 /usr/local/git/bin/git --version 

Check if you can run git to view available help

 /usr/local/git/bin/git --help 

Later, after learning how to use git, you can configure your path to automatically search for git by changing your path using shell scripts, symbolic links. Then any of them will allow you to run:

 git --version git --help 

When working with java or mvn or eclipse the same thing happens. First try the simplest command to make sure you can really run. Then find out how to simplify the process. If git was installed in a different directory, find it, then run it using the entire path.

0
Sep 20 '13 at 3:16
source share

I think I know what you mean. To get started, I did the following:

Open a terminal and run the following command

 cd /usr/local/git/bin 

than trying to run, for example:

 git --version 

or

 git --help 
-2
Jun 11 '14 at 10:52
source share



All Articles