【git】本地仓库与远程仓库如何建立连接
1.在本地创建一个目录,生成 .git文件
git init

2.在gitee里新建一个或者是已存在的仓库,获取ssh

3.再在bash里输入,进行本地与远程仓库的关联
git remote add origin 复制的 ssh 1.新建的远程仓库是空的,要加上-u git push -u origin master 2. 仓库不是空的,就不用加上-u git push origin master
首次执行完这句,以后直接可以用
git push
可能会出现的问题

解决方法:因为新创建的远程仓库里面有 初始化文件,与本地的仓库内容不相符,所以要先同步 !!!!
git pull --rebase origin master
之后再进行 git push origin master 就能成功了。
最后开始提交代码喽!
git add .
git add .
git commit -m "XXXXX"
git push
如果 git push 提示
fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream origin master
To have this happen automatically for branches without a tracking
upstream, see 'push.autoSetupRemote' in 'git help config'.
解决方法
git push origin master
参考地址: https://blog.csdn.net/m0_55251293/article/details/127661445

浙公网安备 33010602011771号