Git configure & terminal command for mac

1. Terminal command

  1. Show folder list: ls
  2. Enter any folder directory: cd folder_name
  3. Create new folder: mkdir foler_name
  4. Back from current directory to previous directory: cd ..
  5. Delete file: rm file_name
  6. Delete folder: rm -r folder_name
  7. Delete multiple folder: rm -r folder1 folder2 folder3
  8. Create new file: touch file_name.extension (example: Test.txt)
  9. Write new text in text file: echo “your_text” > file_name.extension
  10. Showing text file text: cat file_name.extension
  11. Return root directory: cd ~
  12. Show all folder/file also hidden using: ls -a
  13. Open any file: open file_name
  14. Clone github repository: git clone github_url

Git configuration with setup SSH key in github

1. Step_01:

If you don’t have git then install it from git-scm.com. After install it check the git version using command: git –version

2. Step_02:

After successfully install git then config your name & email using command:

  1. For name: git config --global user.name "your name here"
  2. For email: git config --global user.email "your email here"
    N.B: This name and email setup for global, you can setup it for local or system using just –local & –system
  3. Check setup user name using command: git config user.name
  4. Check setup user email using command: git config user.email
    N.B: If you want clear name and email just using this command: git config --global --unset user.name & git config --global --unset user.email

3. Step_03:

Now we will create SSH(Secure Shell) key. It’s stands for communication protocol where one computer communication with another computer securely. Suppose you want to communicate with github then you can use SSH key. if you want to clone without setup SSH key then you get error. Now setup SSH key then clone your repository using:

  1. Check has SSH folder using command: cd .ssh
  2. If you have ssh folder then check has any ssh key using command: ls
  3. If you don’t have ssh folder then create it using command: mkdir .ssh
  4. If you don’t have ssh key then create it using command: ssh-keygen -o -t rsa -C write_your_email_here
  5. Now open public key file using command: cat id_rsa.pub

4. Step_04:

Go to github settings and select SSH & GPG key menu bar, click new ssh key button and paste your key. give any name title like: my macbook.
Now you can clone any repository from terminal using SSH github repository url. Copy your repository ssh url & paste your terminal using command: git clone ssh_github_repository_url and finally press enter button then you will see like this:
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes (type yes and press enter).

27 thoughts on “Git configure & terminal command for mac

Leave a Reply

Your email address will not be published. Required fields are marked *