% cd ${your project}/
% echo "# Test" >> README.md
% git init
Initialized empty Git repository in /Users/${your git name}/git/${your repository name}.git/
% git add README.md
On branch main
No commits yet
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: README.md
% git commit -m "first commit"
[main (root-commit) ....
.
.
.
1 file changed, 43 insertions(+)
create mode 100644 README.md
$ git branch -M main
$ git remote add origin https://github.com/${your git name}/${your repository name}.git
% ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/${userName}/.ssh/id_rsa):
Created directory '/Users/${userName}/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/${userName}/.ssh/id_rsa
Your public key has been saved in /Users/${userName}/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:*
The key's randomart image is:
+---[RSA 3072]----+
.
.
+----[SHA256]-----+
Check id_rsa & id_rsa.pub
% cd /Users/${userName}/.ssh
% ls
id_rsa id_rsa.pub
% cat /Users/${userName}/.ssh/id_rsa.pub
https://github.com/settings/ GitHub >Settings
https://github.com/settings/keys > SSH keys
Click "Add SSH Key" , then Authentication Key has generated.
% git push -u origin main
The authenticity of host 'github.com (20.27.177.113)' can't be established.
ED25519 key fingerprint is SHA256:*.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'github.com' (ED25519) to the list of known hosts.
Before
% ssh -T git@github.com
The authenticity of host 'github.com (20.27.177.113)' can't be established.
After
% ssh -T git@github.com
Hi ${your git name}! You've successfully authenticated, but GitHub does not provide shell access.