How to Download Software From Github in Command Line Mac
Introduction
Gitis a version command organisation that allows developers to rails a project and actively contribute without interfering in each other's work.
It supports collaboration within a project and helps forbid miscommunication or lawmaking clashing betwixt squad members. The system tracks and saves snapshots of an evolving project, essentially keeping a history of the development.
Users who install the software on their machines tin can communicate with each other through the system. An fifty-fifty better solution is collaborating over a centralized source (for example, GitHub) where developers can push and pull changes on the deject.
In this tutorial, you will learn how to install and get started with Git on Mac.
Guide also available for:
CentOS 8
CentOS vii
Ubuntu 18.04
Windows
Prerequisites
- A MacOS
- Access to command line/last window
How to Install Git on Mac
There are many dissimilar ways to prepare upward Git on Mac. If you lot prefer using a GUI, Git offers a simple installation using the installer for Mac. On the other mitt, you can install Git using the terminal with a couple of uncomplicated commands.
Option 1: Install Git on Mac with Installer
The easiest way to fix Git is to employ the Git installer for Mac.
1. Open a browser and navigate toGit'south official website.
2. Y'all will see a brandish showing the version number of the latest source release and a download button, as in the prototype below.
iii. ClickDownload, and information technology automatically downloads the software package on your system.
four. Find the package and double-click to open theGit installer.
5. Follow theinstallation wizardand configure Git to suit your development needs. If you are new to version control systems, the best option would be to leave the default settings.
6. ClickInstall and blazon in your password if necessary.
7. Ostend once once more by clickingInstall Software.
With this, y'all accept finished setting up Git on your Mac. Move on to the next stride ofconfiguring Git.
Pick 2: Install Git on Mac using the Last
There are multiple ways to install Git on Mac via concluding, depending on the development environment or bundle manager you have on your system.
This guide includes three different options.
Install Git Using Xcode
If you adopt the terminal, usingXcode is the fastest and easiest way to beginning working with Git. Its control-line tools include Git in the parcel.
Users who don't have Xcode tin install it with a single control:
xcode-select --install
With Xcode running on your Mac, you can check whether Git is also bachelor by prompting for theGit version:
git --version
The output should display the latest Git release, as in the example below.
git version 2.25.0 (Apple Git-66)
If you exercise non have Git, it automatically asks you lot whether you want to install information technology. Confirm the installation, and Xcode sets upwardly Git.
Install Git Using Homebrew
Another way to install Git is withHomebrew, the packet management organisation for Mac.
Run the following mash
command in the terminal:
mash install git
Then,check the Git version to verify the installation:
git --version
Install Git Using MacPorts
If you are usingMacPorts to manage your packages on the system, you can employ the port
control to ready up Git.
Start byupdating MacPorts with the command:
sudo port selfupdate
Search for and install the newestGit ports and variants by running the post-obit two commands:
port search git
port variants git
Then,install Git with:
sudo port install git
Note: When setting up Git with MacPorts, you lot can install boosted tools you may observe useful in the time to come. Add the bash-completion, svn, and the docs to the control for installing: sudo port install git +svn +doc +bash_completion +gitweb
Get Started with Git on Mac
Configure Git
The next stride is to configure Git past calculation your credentials to the system. This is important as information technology helps keep track of which user is committing changes to a projection.
Open the terminal andconfigure your GitHub username:
git config --global user.name "your_github_username"
Then,add your email:
git config --global user.email "[email protected]"
Runway and Commit Changes
To demonstrate how to piece of work with files on local Git repositories, nosotros are going to create a demo folder and file to work with.
1. Showtime, open the last and create a new folder named NewFolder .
mkdir /Users/[username]/Desktop/Tools/Git/NewFolder
2. Then, move into that directory. The path may differ according to the location where you lot created the new folder.
cd /Users/[username]/Desktop/Tools/Git/NewFolder/
3. As we want to keep track of changes inside this folder, nosotros need to create a local Git repository for it. Running the git init
command initializes an empty git repository in this particular location. Therefore, run the control:
git init
With this, you have added a hidden folder inside the directory by the name .git .
Annotation: To see the hidden .git folder, you demand to run the control: defaults write com.apple.finder AppleShowAllFiles Aye
. If you desire to hide the binder once again, modify the last part of the command by changing the Aye
to NO
).
four. While in the directoryNewFolder, type the following control:
git condition
This shows the country of the working directory and displays if whatever changes made within the directory.
Since the folder nosotros created doesn't take whatever files in it, the output responds with: nothing to commit
.
5. Add some files insideNewFolder and see how thegit statuschanges:
touch file1.txt
six. Check the status over again:
git status
The output tells you there areuntracked files within the directory and lists file1.txt
. Git is tracking the binder in which the file was added, and notifies you that the changes are not being tracked.
7. Prompt Git to rail the new file by running:
git add test1.txt
If you recheck the git status
now, you would run into that the file is now existence tracked (as it inverse from reddish to green). However, you lot nevertheless need tocommitthis change.
viii. Commit all changes and add a message that describes the commit:
git commit -m "added test1.txt"
Now, the output tells y'all the working tree is clean, and there is nothing to commit.
Determination
As you can see, it is not hard to install Git on Mac. After you install Git on Mac, y'all might find helpfulHow to Update Git. With this tutorial, you should have successfully set up Git and configured information technology to showtime working with this version control organization.
Was this article helpful?
Yep No
How to Download Software From Github in Command Line Mac
Posted by: stephanieforits.blogspot.com