Install git on Macbook via Homebrew:
brew install git
Verify the installation:
git --version
Connect to the github account. By using github username and personal access tokens
git config --global user.name "your_github_username"
git config --global user.email "[email protected]"
To create the personal access tokens as github password : From github.com page, hit your github account avatar , then select Settings -> Developer Settings -> Personal Access Tokens -> Generate new token -> Configure the permission and copy the key.
Working with github from your local computer
echo "# mylabtest" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/nguyenkhaclong/mylabtest.git
git push -u origin main
push an existing repository from the command line
git remote add origin https://github.com/nguyenkhaclong/mylabtest.git
git branch -M main
git push -u origin main