- github上新建repo
登錄github,點擊右上角賬戶圖標(菜單),點擊Repositories。新建repo,點擊“clone or download”,得到repo的url:https://github.com/${user}/xxxx.git。 - 配置客戶端與git服務器ssh免交互認證
點擊右上角賬戶圖標(菜單),點擊“settings”,點擊”SSH and GPG keys“。在本地機器上生成ssh keys,將你的SSH key 加入github的ssh-agent【1】。 - 在本地建立目錄並初始化
mkdir your_project
cd your_project
git init
- 添加遠程repo【2】
git remote add origin https://github.com/${user}/xxxx.git
- 提交文件
touch README.md
git add README.md
git commit -m "first commit"
git push -u origin master
【1】generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent
【2】adding-a-remote