在github上新建项目

2020-08-13  本文已影响0人  lenbolan

1. 登录github后,点右上角+号,选择New repository

截屏2020-08-13 下午3.36.50.png

2. 在页面中输入项目名、描述,设置为公开或私有项目,以及是否初始化的同时创建README

截屏2020-08-13 下午3.41.31.png

3. 因我本地已经有完整项目,前往本地项目目录,执行

git init

创建本地项目git仓库

4. 添加项目所有文件到本地仓库

git add ./*
git commit -m "Initial commit."

5. 将前面在github上新建的仓库pull下来,执行

git pull https://github.com/youraccount/yourprojectname.git

如果出现 fatal: refusing to merge unrelated histories


截屏2020-08-13 下午4.02.45.png

执行命令

git pull origin master --allow-unrelated-histories

强制合并

6. 添加远程版本库

git remote add origin https://github.com/youraccount/yourprojectname.git

7. 推送到github

git push -u origin master
上一篇 下一篇

猜你喜欢

热点阅读