- Xóa commit gần nhất đã được commit từ máy local:
git reset --soft HEAD~1
- Xem nội dung commit gần nhất:
git commit --amend
- Cấu hình các thông số cơ bản
git config --global user.name "trangnth"
git config --global user.email "[email protected]"
git config --global core.editor vim
git config --list
- Tạo ssh key cho tài khoản Github
ssh-keygen -t rsa -b 4096 -C "[email protected]"
- Copy nội dung public key và paste lên github
[root@trang-40-75 ~]# cat /root/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDo5EUdkDUwC5EGSUIFXcyic+PEP4TT3+K5yM2iZL89uKxDig9VoNUqBPAtLtzI/GuQHLdtOtXhqPN/v9NpcQv2pIIifiiJSea3IFHsb9jyHhhLd9eZjjdNT2/[email protected]
- Trên server thực hiện
ssh -T [email protected]
cd Upstream-OPS/
git remote set-url origin [email protected]:trangnth/Upstream-OPS.git
git push origin master
[1] https://help.github.com/en/articles/adding-a-new-ssh-key-to-your-github-account