git使用攻略

  1. github上創建項目web-gradle
  2. 本地如果是第一次使用,需要一些簡單地配置。

    git config –global user.name “你的名字或暱稱”
    git config –global user.email “你的郵箱”

  3. 本地生成ssh公鑰加入github的ssh keys中

    ssh-keygen -t rsa -C “[email protected]
    # Generating public/private rsa key pair…
    # 三次回車即可生成 ssh key

    查看public key添加到ssh keys中

    cat ~/.ssh/id_rsa.pub
    # ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC6eNtGpNGwstc….

    本地終端輸入 ssh -T [email protected] 若返回Welcome xxx, xxx!說明添加成功。

  4. 本地項目實例化

    項目根目錄 git init
    git remote add origin https://github.com/yulele166/web-gradle.git

  5. 提交操作

    git pull origin master 提交之前先拉取
    git add . 添加當前目錄下變動的文件
    git commit -m “提交註釋”
    git push origin master 提交操作
    或git push origin master -f 強制提交

    參考http://git.mydoc.io/?t=180676

git pull遇到錯誤:error: Your local changes to the following files would be overwritten by merge
git stash
git pull origin master
git stash pop

發佈了110 篇原創文章 · 獲贊 70 · 訪問量 21萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章