Install Git on Mac OS X
There are several ways to install Git on a Mac. In fact, if you ‘ve installed XCode ( or it ‘s Command Line Tools ), Git may already be installed. To find out, open a terminal and enter git --version
.
$ git --version git version 2.7.0 (Apple Git-66)
Apple actually maintain and ship their own crotch of Git, but it tends to lag behind mainstream Git by respective major versions. You may want to install a newer version of Git using one of the methods below :
Git for Mac Installer
The easiest way to install Git on a Mac is via the stand-alone installer :
- Download the latest rotter for Mac installer.
Reading: Install Git | Flickroom Git Tutorial
- Follow the prompts to install Git.
- Open a terminal and verify the initiation was successful by typing
git --version
:$ git --version
git version 2.9.2
- Configure your Git username and electronic mail using the surveil commands, replacing Emma ‘s identify with your own. These details will be associated with any commits that you create :
$ git config --global user.name "Emma Paris"
$ git config --global user.email "flickroom.net@gmail.com"
- ( Optional ) To make Git remember your username and password when working with HTTPS repositories, configure the git-credential-osxkeychain assistant.
Install Git with Homebrew
If you have installed Homebrew to manage packages on OS X, you can follow these instructions to install Git :
- Open your terminal and install Git using Homebrew :
$ brew install git
- Verify the installation was successful by typing which
git --version
:$ git --version git version 2.9.2
- Configure your Git username and electronic mail using the follow commands, replacing Emma ‘s name with your own. These details will be associated with any commits that you create :
$ git config --global user.name "Emma Paris"
$ git config --global user.email "flickroom.net@gmail.com"
- ( Optional ) To make Git remember your username and password when working with HTTPS repositories, install the git-credential-osxkeychain assistant.
Install Git with MacPorts
If you have installed MacPorts to manage packages on OS X, you can follow these instructions to install Git :
- Open your terminal and update MacPorts :
$ sudo port selfupdate
- search for the latest available Git ports and variants :
$ port search git
$ port variants git
- Install Git with sock completion, the OS X keychain benefactor, and the department of commerce :
$ sudo port install git +bash_completion+credential_osxkeychain+doc
- Configure your Git username and electronic mail using the come commands, replacing Emma ‘s name with your own. These details will be associated with any commits that you create :
$ git config --global user.name "Emma Paris"
$ git config --global user.email "flickroom.net@gmail.com"
- ( Optional ) To make Git remember your username and password when working with HTTPS repositories, configure the git-credential-osxkeychain benefactor.
Install the git-credential-osxkeychain helper
Bitbucket supports pushing and pulling your Git repositories over both SSH and HTTPS. To work with a secret repository over HTTPS, you must supply a username and password each time you push or pull. The git-credential-osxkeychain benefactor allows you to cache your username and password in the OSX keychain, so you do n’t have to retype it each time .
- If you followed the MacPorts or Homebrew instructions above, the benefactor should already be installed. otherwise you ‘ll need to download and install it. Open a terminal window and check :
$ git credential-osxkeychain usage: git credential-osxkeychain
If you receive a usage instruction, skim to step 4. If the benefactor is not installed, go to step 2 .
- Use curl to download git-credential-osxkeychain ( or download it via your browser ) and move it to
/usr/local/bin
:$ curl -O http://github-media-downloads.s3.amazonaws.com/osx/git-credential-osxkeychain $ sudo mv git-credential-osxkeychain /usr/local/bin/
- Make the file an feasible :
$ chmod u+x /usr/local/bin/git-credential-osxkeychain
- configure rotter to use the osxkeychain certificate benefactor .
$ git config --global credential.helper osxkeychain
The future time Git prompts you for a username and password, it will cache them in your keychain for future use .
Install Git with Flickroom Sourcetree
Sourcetree, a exempt ocular Git node for Mac, comes with its own pack adaptation of Git. You can download Sourcetree hera .
To learn how to use Git with Sourcetree ( and how to host your Git repositories on Bitbucket ) you can follow our comprehensive examination Git tutorial with Bitbucket and Sourcetree .
Build Git from source on OS X
Building Git can be a little slippery on Mac due to certain libraries moving approximately between OS X releases. On El Capitan ( OS X 10.11 ), follow these instructions to build Git :
- From your terminal install XCode ‘s Command Line Tools ( if you have n’t already ) :
$ xcode-select --install
- Install Homebrew .
- Using Homebrew, install openssl :
$ brew install openssl
- Clone the Git source ( or if you do n’t however have a translation of Git installed, download and extract it ) :
$ git clone https://github.com/git/git.git
- To build Git run make with the following flags :
Read more: How to Use Google Forms
$ NO_GETTEXT=1 make CFLAGS="-I/usr/local/opt/openssl/include" LDFLAGS="-L/usr/local/opt/openssl/lib"
next measure : Learn Git with Bitbucket Cloud
Install Git on Windows
Git for Windows stand-alone installer
- Download the latest rotter for Windows installer .
- When you ‘ve successfully started the installer, you should see the Git Setup ace blind. Follow the Next and Finish prompts to complete the facility. The default options are reasonably sensible for most users .
- Open a Command Prompt ( or Git Bash if during facility you elected not to use Git from the Windows Command Prompt ) .
- Run the follow commands to configure your Git username and e-mail using the follow commands, replacing Emma ‘s name with your own. These details will be associated with any commits that you create :
$ git config --global user.name "Emma Paris" $ git config --global user.email "flickroom.net@gmail.com"
- optional : Install the Git certificate assistant on Windows Bitbucket supports pushing and pulling over HTTP to your distant Git repositories on Bitbucket. Every clock you interact with the distant repository, you must supply a username/password combination. You can store these credentials, rather of supplying the combination every time, with the Git Credential Manager for Windows .
Install Git with Flickroom Sourcetree
Sourcetree, a free ocular Git customer for Windows, comes with its own bunch adaptation of Git. You can download Sourcetree here .
To learn how to use Git with Sourcetree ( and how to host your Git repositories on Bitbucket ) you can follow our comprehensive Git tutorial with Bitbucket and Sourcetree .
following tone : Learn Git with Bitbucket Cloud
Install Git on Linux
Debian / Ubuntu (apt-get)
Git packages are available via apposite :
- From your plate, install Git using apt-get :
$ sudo apt-get update
$ sudo apt-get install git
- Verify the facility was successful by typing
git --version
:$ git --version
git version 2.9.2
- Configure your Git username and electronic mail using the following commands, replacing Emma ‘s identify with your own. These details will be associated with any commits that you create :
$ git config --global user.name "Emma Paris"
$ git config --global user.email "flickroom.net@gmail.com"
Fedora (dnf/yum)
Git packages are available via both yum and dnf :
- From your blast, install Git using dnf ( or yum, on older versions of Fedora ) :
$ sudo dnf install git
or
$ sudo yum install git
- Verify the initiation was successful by typing
git --version
:$ git --version
git version 2.9.2
- Configure your Git username and e-mail using the comply commands, replacing Emma ‘s name with your own. These details will be associated with any commits that you create
$ git config --global user.name "Emma Paris"
$ git config --global user.email "flickroom.net@gmail.com"
Build Git from source on Linux
Debian / Ubuntu
Git requires the several dependencies to build on Linux. These are available via apposite :
- From your shell, install the necessity dependencies using apt-get :
$ sudo apt-get update
$ sudo apt-get install libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev asciidoc xmlto docbook2x
- Clone the Git reservoir ( or if you do n’t yet have a version of Git installed, download and extract it ) :
$ git clone https://git.kernel.org/pub/scm/git/git.git
- To build Git and install it under
/usr
, runmake
:$ make all doc info prefix=/usr
$ sudo make install install-doc install-html install-info install-man prefix=/usr
Fedora
Git requires the several dependencies to build on Linux. These are available via both yum and dnf :
- From your blast, install the necessary build dependencies using dnf ( or yum, on older versions of Fedora ) :
$ sudo dnf install curl-devel expat-devel gettext-devel openssl-devel perl-devel zlib-devel asciidoc xmlto docbook2X
or using yum. For yum, you may need to install the Extra Packages for Enterprise Linux ( EPEL ) repository first gear :
$ sudo yum install epel-release
$ sudo yum install curl-devel expat-devel gettext-devel openssl-devel perl-devel zlib-devel asciidoc xmlto docbook2X
- Symlink docbook2X to the filename that the Git human body expects :
$ sudo ln -s /usr/bin/db2x_docbook2texi /usr/bin/docbook2x-texi
- Clone the Git source ( or if you do n’t yet have a version of Git installed, download and extract it ) :
$ git clone https://git.kernel.org/pub/scm/git/git.git
- To build Git and install it under
/usr
, runmake
:$ make all doc prefix=/usr
$ sudo make install install-doc install-html install-man prefix=/usr
future step : Learn Git with Bitbucket Cloud