Git Notes - goldpot/scripts GitHub Wiki
-
First create your SSH keys (Secure shell protocol)
-
ssh-keygen -t -rsa -C "[email protected]" --> could be any string (try it) Generating public/private rsa key pair Enter file in which to save the key(/Users/u/.ssh/id_rsa): Enter passphrase(empty or no passphrase): Enter same passphrase again: Saving key "
/.ssh/id_rsa" failed : no such file or directory --> this is because there is no directory in the home () called ssh , "." in .ssh means hidden files . -
create a dir called .ssh --> mkdir ~/.ssh
-
now go into .ssh dir --> cd .ssh
-
.ssh ssh-keygen -t -rsa -C "[email protected]" Generating public/private rsa key pair Enter file in which to save the key(/Users/u/.ssh/id_rsa): Enter passphrase(empty or no passphrase): Enter same passphrase again: Your identification has been saved in id_rsa. Your public key has been saved in id_rsa.pub.
-
.ssh ls --> list all files in .ssh directory to check if you have the two keys id_rsa id_rsa.pub known_hosts
-
now open the public key id_rsa.pub by cat id_rsa.pub --> copy the contents and paste it onto your github account settings ( new public key there)
-
This step will authenticate your github account
-
now in the ssh directory do a -- this will test the SSH key setup -> .ssh ssh -T [email protected] Hi awesome! YO've successfully authenticated , but github does not provide shell access
-
Now clone your github repo ( which you have previoucle created in your github account)
-
my_project git clone [email protected]:yourgithubid/react_python.git cloning into react_python
-
my_project cd react_python Once you have cloned now lets try to add a readme.md file
-
react_python git:(master) touch readme.md
-
This will open up a readme.md file in nano editor( my set up)
-
type out what you intend for the project to do. 16 ctrl o + enter in nano editor to save the file
-
now do a git add readme.md
-
this will add the file into the staging area of the repository
-
now let's add a commit with an initial comment - git commit -m "feat:first commit"
-
do a git status to ensure you see "working tree clean " message
-
git push --> this will push your local repo changes to remote repo