Create Public Repository in GitHub and Commit README File on Mac - VicPhanDevOps/mac GitHub Wiki
• Go to https://github.com/ in a web browser and select “New.”
•
• Type desired repository name in the “Repository name *” box.
•
• Type a description in the “Description (optional)” box and select “Create repository.”
•
• The new repository will be created.
•
• Browse in the Finder to the directory you want the repository in and right-click the directory. Expand the “Services” menu and select “New Terminal at Folder.”
•
• Type mkdir < new repository >
and press the return key to create a new directory for the new repository.
•
• Type cd < new repository >
and press the return key to change directory into the new repository.
•
• Type echo “# < new repository >” >> README.md
and press the return key to create the README.md file.
•
• Type git init
and press the return key to initialize Git.
•
• Type git add README.md
and press the return key to stage the README.md file.
•
• Type git commit -m “< commit message >”
and press the return key to commit the change with a commit message.
•
• Type git branch -M main
and press the return key to make the current branch the main
branch.
•
• Type git add remote origin < new repository URL >.git
and press the return key to add the new remote origin to your repository.
•
• Type git push -u origin main
and press the return key to push changes up to GitHub.
•
• Return to the GitHub, refresh the browser and you will see the README.md in your new repository. •