一、登录github创建项目 ,步骤如下:
1、点击新建
2、填写仓库名称等
3、创建完成
二、关联已有的本地项目(没有需要关联的本地项目,可以直接从刚刚创建的github仓库clone)
1、到本地项目文件夹下用git命令行依次输入下面的两条命令
git init
ps e:\code> git init
initialized empty git repository in e:/code/.git/
ps e:\code> git remote add origin https://github.com/zhi-nian/vuepractice.git
三、上传自己的本地代码
1、编辑器报错
2、解决办法
切换到项目所在目录,在命令行窗口依次输入
git pull
git pull origin master
git pull origin master --allow-unrelated-histories
执行结果如下:
ps e:\code> git pull
warning: no common commits
remote: enumerating objects: 3, done.
remote: counting objects: 100% (3/3), done.
remote: total 3 (delta 0), reused 0 (delta 0), pack-reused 0
unpacking objects: 100% (3/3), done.
from https://github.com/zhi-nian/vuepractice
* [new branch] master -> origin/master
there is no tracking information for the current branch.
please specify which branch you want to merge with.
see git-pull(1) for details.
git pull
if you wish to set tracking information for this branch you can do so with:
git branch --set-upstream-to=origin/ master
ps e:\code> git pull origin master
from https://github.com/zhi-nian/vuepractice
* branch master -> fetch_head
fatal: refusing to merge unrelated histories
ps e:\code> git pull origin master --allow-unrelated-histories
from https://github.com/zhi-nian/vuepractice
* branch master -> fetch_head
merge made by the 'recursive' strategy.
readme.md | 2 ++
1 file changed, 2 insertions(+)
create mode 100644 readme.md
完事儿直接用编辑器重新提交代码 ok!
四、代码下拉
1、代码下拉遇到的问题
2、解决办法
切换到项目所在目录,在命令行窗口输入
git branch --set-upstream master origin/master 或 git branch --track master origin/master
执行结果如下:
ps e:\code> git branch --set-upstream master origin/master
the --set-upstream flag is deprecated and will be removed. consider using --track or --set-upstream-to
branch master set up to track remote branch master from origin.
这样就ok了 可以下拉更新了
五、删除项目 步骤如下图
1、
2、
3、
4、完成
希望与广大网友互动??
点此进行留言吧!