將本地工程推送到github

  1. github上新建repo
    登錄github,點擊右上角賬戶圖標(菜單),點擊Repositories。新建repo,點擊“clone or download”,得到repo的url:https://github.com/${user}/xxxx.git。
  2. 配置客戶端與git服務器ssh免交互認證
    點擊右上角賬戶圖標(菜單),點擊“settings”,點擊”SSH and GPG keys“。在本地機器上生成ssh keys,將你的SSH key 加入github的ssh-agent【1】。
  3. 在本地建立目錄並初始化
mkdir your_project
cd your_project
git init
  1. 添加遠程repo【2】
git remote add origin https://github.com/${user}/xxxx.git
  1. 提交文件
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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章