Skip to content

Latest commit

 

History

History
53 lines (35 loc) · 1.13 KB

ghichep-git.md

File metadata and controls

53 lines (35 loc) · 1.13 KB

Một số các ghi chú về git trong quá trình tìm hiểu và sử dụng

  • 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 Git cho Linux

  • 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

Tham khảo

[1] https://help.github.com/en/articles/adding-a-new-ssh-key-to-your-github-account