Git连接gitee远程仓库

1.在要上传的本地文件夹右键选择Git Bash

2.输入 git init,会在本地文件生成.git文件,该文件是隐藏的

3.输入 git remote add origin https://gitee.com/wpsunbo/used-car-trading-platform.git

  • origin是自己取的仓库名
  • master是分支
  • 仓库地址在管理仓库中查看

4.此时会弹出窗口,要求输入用户名和密码,输入自己gitee的账号密码即可

5.输入 git pull origin master,将码云上的仓库pull到本地文件夹

注意:确保仓库已经生成默认的readme文件,仓库不能为空

问题:运行出现 fatal: refusing to merge unrelated histories

解决方法:在你操作命令后面加--allow-unrelated-histories
         比如 git pull origin master --allow-unrelated-histories、

6.输入 git add .(. 表示所有的)或者 git add + 文件名

7.输入 git commit -m '新添加的文件内容描述' 或 git commit

注意:只输入git commit 会进入编辑模式,ESC后输入:wq退出即可

8.输入 git push origin master

问题:error: failed to push some refs to ‘https://gitee.com/

解决方法:没有从仓库pull Readme文件 ,执行第五步命令即可
posted @ 2022-07-16 17:15  lwx_R  阅读(149)  评论(0编辑  收藏  举报