1.設定git使用者和郵箱
git config --global user.name "fujinzhou"
git config --global user.email "[email protected]"
2.生成SSH密鑰
ssh-keygen -t rsa //直接敲3次回車,預設key放在/root/.ssh/下
3.在github上添加ssh密鑰
cat /root/.ssh/id_rsa.pub //複制到github上(Settings-->SSH andGPG keys-->New SSH key),title随意
4.測試認證是否成功
[root@localhost data]# ssh -T [email protected]
The authenticity of host 'github.com (192.30.253.113)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,192.30.253.113' (RSA) to the list of known hosts.
Hi fujinzhou! You've successfully authenticated, but GitHub does not provide shell access.
5.克隆代碼
git clone ssh://[email protected]/51reboot/actual-10-homework.git
git pull origin master 從git 拉代碼
git常用指令
檢視工作狀态、
git status
送出所有代碼
git add .
本地送出
git commit -m "test"
送出到遠端
git push origin master
本文轉自 shouhou2581314 51CTO部落格,原文連結:xxhttp://blog.51cto.com/thedream/1828437xxxxx,如需轉載請自行聯系原作者