本地项目关联github上的new repository

2017-08-11  本文已影响0人  lijiaccy

首先在github上新建一个repository

图片.png

然后输入这个名字

图片.png

这样github上多了一个repository

图片.png

命令行上传

进入项目文件夹中

 git init                   # 本地仓库初始化,执行完后会在工程目录下生成一个.git的隐藏目录
 git add .               # 添加所有文件到本地索引,命令用法:git add <file>
 git commit -m "My first commit operation"   # 提交修改到本地仓库,-m选项添加提交注释
 git remote add origin https://github.com/lijiaccy/tttt.git   # 添加远程仓库地址(在github中看),保存在origin变量中
 git push -u origin master      # 按照前一条命令中origin给定的github地址推送到github仓库的master分支

 **最后一步有可能报错,如果报错先执行**
   git pull origin master
  然后再执行git push -u origin master 

搞定。

上一篇 下一篇

猜你喜欢

热点阅读