logo

Git初始化命令+重置本地仓库

# 系统记住git密码
git config --global user.name "user"
git config --global user.email "user@xx.com"
git config --global credential.helper store
# 从命令行创建一个新的仓库
touch README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin http://git.xx.com/xx/xx.git
git push -u origin master
# 从命令行推送已经创建的仓库
git remote add origin http://git.xx.com/xx/xx.git
git push -u origin master
# 丢弃本地所有修改,以远程仓库为准
git reset --hard FETCH_HEAD
闽ICP备17019312号-1