git 本地仓库关联到远程仓库

将本地仓库关联到远程仓库

方式一:远程仓库没有文件

第一步:

复制代码
git init(初始化git仓库)

第二步:

复制代码
 git remote add 地址(设置remote地址)

第三步:

复制代码
 git add . (将所有变更提交到本地仓库)

第四步:

复制代码
 git commit -m '' (提交注释)

第五步:

复制代码
git push(本地仓库推送到远程仓库)

方式二:远程仓库有文件

第一步:

复制代码
git init(初始化git仓库)

第二步:

复制代码
git remote add origin 地址(设置远程remote地址)

第三步:

复制代码
git pull origin master(拉取远程仓库master的文件)

第四步:

复制代码
 git branch --set-upstream-to=origin/master master(将本地master设置为远程master分支)

第五步:

复制代码
 git add . (将所有变更提交到本地仓库)

第六步:

复制代码
git commit -m '' (提交注释)

第七步:

复制代码
git push(本地仓库推送到远程仓库)

方式三:(推荐,感觉这种最简单)

第一步:

建一个文件夹,进入文件夹打开命令行工具;

第二步:

复制代码
git clone 地址(克隆远程仓库)

第三步:

*  将项目文件复制到新建文件夹中
第四步:*

复制代码
git add . (将所有变更提交到本地仓库)

第五步:

复制代码
 git commit -m '' (提交注释)

第六步:

复制代码
 git push(本地仓库推送到远程仓库)

设置用户和邮箱

一:全局

复制代码
git config --global user.name "you name"
git config --global user.email "you email"

二:局部(单个项目)

复制代码
git config user.name "you name"
git config user.email "you email"

原文链接:https://blog.csdn.net/sinat_39049092/article/details/113417142

相关推荐
MUTA️4 小时前
git传输超过100MB的文件
git
ALex_zry4 小时前
Git大型仓库推送失败问题完整解决方案
大数据·git·elasticsearch
二进制coder6 小时前
Git Fork 开发全流程教程
大数据·git·elasticsearch
程序员馨馨6 小时前
不扰远程仓库,本地双版本:master 留 A 稿,分支藏 B 稿
git
无限进步_6 小时前
C语言动态内存的二维抽象:用malloc实现灵活的多维数组
c语言·开发语言·数据结构·git·算法·github·visual studio
用户47861297206927 小时前
Git:如何排查非线性历史中被隐秘覆盖的修改(完整实战笔记)
git
weixin_3776348410 小时前
【Git使用】PyCharm中的Git使用
ide·git·pycharm
爱吃泡芙的小白白12 小时前
vscode、anaconda、git、python配置安装(自用)
ide·git·vscode·python·anaconda·学习记录
ALex_zry18 小时前
Git大型仓库推送失败问题解决方案:大文件传输优化指南
git
草莓熊Lotso18 小时前
Git 分支管理:从基础操作到协作流程(本地篇)
大数据·服务器·开发语言·c++·人工智能·git·sql