git操作
1.配置账号
git config --global user.name "Administrator"
git config --global user.email "[email protected]"
2.如果是创建一个新仓库,则命令如下:
git clone http://192.168.1.103:8001/qf/secondproject.git
cd secondproject
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master
3.推送一个已存在的文件夹
cd existing_folder
git init
git remote add origin http://192.168.1.103:8001/qf/secondproject.git
git add .
git commit -m "Initial commit"
git push -u origin master
4.推送一个已存在的仓库
cd existing_repo
git remote rename origin old-origin
git remote add origin http://192.168.1.103:8001/qf/secondproject.git
git push -u origin --all
git push -u origin --tags
5.'fatal:remote origin already exists'问题处理步骤:
git添加远程库的时候有可能出现如下的错误:
fatal:remote origin already exists
怎么解决?
只要两步:
1.先删除:
$ git remote rm origin
2.再次执行添加就可以了.
6.git push origin master上传本地项目到远程仓库时,报错“fatal: 'origin' does not appear to be a git repository”的解决办法.
原因: 没有关注远程仓库为origin
解决: git remote add origin “远程仓库地址”