You can't use Git until you make it available on your computer. There are a couple different ways you can install Git and make it available for use. The option you choose will depend on the system you are running.
Brew Update Git
In this article, I will show you how to install Git on a MAC OS, as well as how to install Git on LINUX.
A couple of things you will want to make note of while interacting with Git.
- Just enter it, it will be stored in keychain from then on. - password update Open keychain, delete the entry for the repository you are trying to use. (git remote -v will show you) On next use of git push or something that needs permissions, git will ask for the credentials, as it can not find them in the keychain anymore.
- Git SCM does not comes out-of-the-box(OOTB) with Mac OS X. However if you have installed Xcode command line tools or standalone Git Installer then you will have Git SCM on Mac OS X.
( If that does not work, you probably have to update/remove-reinstall a Xcode at all - now that I am writing, I remember I struggled a bit more few months ago with the old mac at work) After that Git will work. But now every time you try to git push/pull you are requested the passphrase for key. Pretty annoying. SourceTree can do much more, of course, but I personally find that viewing history is where git GUI clients really shine compared to the command line. I have tried other git GUI clients, including Tower, GitKraken and GitUp. But I find SourceTree far more comfortable and efficient than the others - especially for viewing history and changes.
- Even if you already have Git installed it is a good idea to update to the latest version.
- All of the commands below should work, even on the older versions of Git. They may act a little differently but should work. Git is very good at preserving backward compatibility. Any version after 2.0 should work just fine.
How To Install Git on MAC OS
There are a couple of ways to install Git on MAC OS. The easiest way to do it would probably be to install the Xcode Command Line Tools. This will work on Mavericks (10.9) or above, so it should cover you. If you are running on OS older than that I would recommend you look into upgrading that first.
If your MAC OS is good to go simply run git from the Terminal the very first time. Here is what that would look like:
If it isn't installed you will be prompted to install. If it is installed, then the above command should output the current version installed.
If you need or want a more up-to-date version, then you can install Git on MAC OS via a binary installer. There is a MAC OS Git installer that is maintained and made available for download on the Git website, at https://git-scm.com/download/mac.
Finally, a third option of installing Git on MAC OS is to install it as part of the GitHub for MAC install.
They have a GUI Git tool that has an option to install command line tools as well. You can download this tool from the GitHub for MAC website, at https://mac.github.com.
How To Install Git on Linux
More often than not you can install Git on Linux via a binary installer through the package management tool that comes with your distribution.
If you're on Fedora or other closely related RPM-based distribution, like RHEL or CentOS, you can use dnf:
$ sudo dnf install git-all
If you happen to be on a Debian-based distribution, like Ubuntu, try using apt:
Installation For Other Unix Distributions
Gentoo
# emerge –ask –verbose dev-vcs/git
Arch Linux
openSUSE
# zypper install git
Mageia
Nix/NixOS
# nix-env -i git
FreeBSD
Solaris 9/10/11 (OpenCSW)
# pkgutil -i git
Solaris 11 Express
OpenBSD
# pkg_add git
Alpine Will mac run on my pc.
Slitaz
$ tazpkg get-install git
Author: Jeremy Holcombe
Growing up in Hawaii, Jeremy started his freelance writing career doing resumes, business plans, article writing, and everything in between. He now specializes in online marketing and content writing and is part of the Content Marketing Team at GreenGeeks. Update mac os x 10 6 8 to sierra.
Was this article helpful?
Related Articles
Installing and configuring Git on macOS can seem difficult if you've never used a command line before, but there are only a few things to learn to get started. This guide will take you through the steps to install and configure Git and connect it to remote repositories to clone, push, and pull.
Installing Git
Download the latest Git installer package, double click on the installer to start the installation wizard. You'll be prompted for your system password in order for the installer to complete.
After you have successfully installed Git on Mac, you'll need to provide secure communication with your Git repositories by creating and installing SSH keys.
Creating SSH keys on Mac
To communicate with the remote Git repository in your Beanstalk account from your Mac, you will need to generate an SSH key pair for that computer. This process requires only a few steps, and all of the tools necessary are included on your Mac.
Launching Terminal
Update Git Version Mac
Terminal is an application that comes with macOS and provides you with an interface to run text commands, switch through folders, and manage files. You can usually find it in your Applications → Utilities folder.
Generating a key pair
Type these commands in your Terminal window and press Return. First make sure you are in your home directory:
and then generate the keypair with:
It will ask for location, just accept the default location (~/.ssh/id_rsa.pub
) by pressing Return. When it asks for a pass phrase, make sure to set a strong pass phrase for the key. We've included some additional information about SSH keys and how to manage strong pass phrases in our Tips for using SSH Keys guide.
Now that the keys are generated, copy it to your clipboard for the next step:
Your public key is now on your clipboard and you can easily add it to a version control hosting account like Beanstalk. When you paste it, your SSH public key should look something like this:
In your Beanstalk account, the added SSH key will look like this:
Checking your connection
Before trying to access your Git remote repository, check if the connection to your remote hosted Git repository works. Enter the following command in the Terminal, replacing 'accountname' with your account name:
In this case, this is the URL to access Git on your Beanstalk account. If you are using another version control hosting service, the URL would be provided by them.
You'll most likely encounter a message that looks like this:
You can type yes
and press Enter, which will add your account's hostname accountname.beanstalkapp.com to a known_hosts
file. This step won't need to be repeated unless your public key or your account names changes. Also, this must be done from the Terminal before using any GUI clients.
If you were authenticated correctly, you will see a message similar to this one:
You can now continue to configure your local Git profile.
Setting up your Git Profile
Setting up your Git Profile
How To Upgrade Git
After you have authenticated correctly by installing Git and setting up SSH keys, before you start using your Git repositories, you should setup your Git profile by typing following after you run Git bash in command line:
In case you are using Beanstalk for version control, it would be best if your first name, last name and email address match to the ones you use in your account to avoid any conflicts.
Summary
Upgrade Git Command Line
In order to be able to use your repository you need to:
- Install Git
- Generate SSH keys with
ssh-keygen
- Check if the connection to the Git repository is working
- Set up your Git profile
While getting started with Git, the most common mistakes include mismatched private and public SSH keys or the Beanstalk user not having permission to access the repository. Make sure to check these after you have finished setting up Git. If you run into issues, just contact us using one of the links below.
Brew Upgrade Git
Now what?
Now that you have Git properly installed and configured, you can use a client of your choice. Whether you choose a terminal or a GUI, it is a good idea to learn the basic concepts and commands for versioning your files before. Here's some recommended reading to get you started:
- Git Immersion Tutorial – an excellent step-by-step tutorial to using Git
- Pro Git E-book and Printed Edition
- The Git Parable – understand the concepts behind Git with a simple story by Tom Preston-Werner