Wednesday, August 30, 2023

Create new repo from terminal in macOS

In Windows, we are used to right click into our folder and open With GitBash. Let’s do something similar in macOs


Go to Finder (it’s in the Dock), open Documents, create new folder, let’s say “MyRepos”, Ctrol+Click the folder and New terminal at Folder.

In the terminal, continue doing what you already know…


git init

git add …

git commit …

Blah blah

Install and Config GIT on MAC


The best option to install GIT in Mac is thru Homebrew. So, you should install it first


Open launchpad, search by “terminal”

Run this command:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"


(Visit the official website to get the news: https://brew.sh)


All you need to do is to wait and read the console. The console will ask you to do something (copy a command, past it and run it)


Now you are ready to install GIT thru this command:

brew install git (Visit the official website to get the news: https://git-scm.com/download/mac)


Run git —version to confirm you already have git installed


Unlike Windows, you will not get a new terminal


Now you have GIT, next step is to configure GIT


In the same terminal, run this:


git config —global user.name “your-username”

git config —global user.email “your-email”


You can see your configuration running this:

git config —list


Voila