- github上創建項目web-gradle
本地如果是第一次使用,需要一些簡單地配置。
git config –global user.name “你的名字或暱稱”
git config –global user.email “你的郵箱”本地生成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!說明添加成功。
本地項目實例化
項目根目錄 git init
git remote add origin https://github.com/yulele166/web-gradle.git提交操作
git pull origin master 提交之前先拉取
git add . 添加當前目錄下變動的文件
git commit -m “提交註釋”
git push origin master 提交操作
或git push origin master -f 強制提交
git pull遇到錯誤:error: Your local changes to the following files would be overwritten by merge
git stash
git pull origin master
git stash pop