GIt系列:远程仓库使用总结
一、不存在本地仓库(只clone)
1.新建远程仓库
gitee官网新建个远程仓库,输入基本信息。
选不选README文件都一样
2.本地操作
选择clone目录
例:
E:\个人学习\git系列\test001
git进入该目录
执行以下命令
//远程仓库地址
git clone https://gitee.com/*/test.git
你会发现你将仓库test已下载至当前目录。
//进入test目录
cd test
//新建git.txt文件测试
git add .
git commit -m '说明'
//origin默认远程仓库名
git push origin master
重点,clone仓库后,一定别忘记进入该仓库后,再进行操作!!!
二、存在本地仓库,将本地仓库上传gitee
新建远程仓库
gitee官网新建个远程仓库,输入基本信息。
git进入你想连接远程仓库目录
## 这也就OK
@IT-PC-014 MINGW64 /e/个人学习/git系列/test005 (master)
执行以下命令
//初始化仓库。未初始化才操作
git init
//连接远程仓库
git remote add origin https://gitee.com/*/test004.git
//查看远程仓库
git remote -v
//执行pull操作
git pull origin master
//新建git.txt测试
git add .
git commit -m '说明'
git push origin master
去远程仓库查看,成功!
三、总结
事实上,新手操作不会这么一帆风顺。多测试测试,慢慢就会属性。
下面是我学习过程中遇到的常见错误,希望能给大家带来帮助。
push失败原因总结
Git系列:git pull/push操作需要输入账号密码