当前位置: 移动技术网 > IT编程>开发语言>JavaScript > 新建GitHub项目与删除

新建GitHub项目与删除

2019年06月27日  | 移动技术网IT编程  | 我要评论

一、登录github创建项目 ,步骤如下:

  1、点击新建

  2、填写仓库名称等

3、创建完成

 

 二、关联已有的本地项目(没有需要关联的本地项目,可以直接从刚刚创建的github仓库clone)

1、到本地项目文件夹下用git命令行依次输入下面的两条命令

git init
git remote add origin https://github.com/zhi-nian/vuepractice.git
执行结果如下:
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 <remote> <branch>

if you wish to set tracking information for this branch you can do so with:

    git branch --set-upstream-to=origin/<branch> 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、完成

 

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网