Mac 上传本地项目到GitHub

前提:已经配置好了远程git

参考链接:https://blog.csdn.net/qq_33281417/article/details/69396666

在github上新建一个空的项目,不需要ignore和readme文件

执行以下步骤就可以把项目上传到github上啦

cd XXX/XXX // 打开终端 进入项目的根目录
git init // 初始化git
git add . // add所有文件
git commit -m "first commit" // 提交到本地仓库
git branch -M main // 设置branch
git remote add origin https://github.com/... // 项目地址
输入github的账号和密码
git push -u origin main // 提交到远程库

其中项目地址在创建项目后在下图所示位置查看:

 

如果项目有其他人一起开发,在push代码之前需要pull一下最新的代码,命令如下:

git pull origin master 

--------------------------

作者:keyuan0214
链接:https://www.jianshu.com/p/dfd0be6f96f4
来源:简书

原文地址:https://www.cnblogs.com/RB26DETT/p/13848372.html