- create ssh key cd ~/.ssh ls // if there is no id_rsa.pub, then create it using ssh-keygen -t rsa -b 4096 -C "[email protected]" vim id_rsa.pub // copy the key and paste it to your github account
- init the repository in your computer and gitpull cd workingdir/ git init git add README.md //choosable git add . // add all files git add //add a certain file git commit -m "first commit" //""is the message git remote add origin [email protected]:yourname/yourrepo.git git push -u origin main //becarful of the branch name
- check the branch git branch git checkout main //main branch
- check out the file status git status
- add file to Standing Area git add . //add all files git add //add a certain file
- commit the file git commit -m "second commit"
- pull the latest code form remote repository before pushing git pull origin main
- push the file to the github git push origin main