使用Git在本地创建一个项目的过程
$ makdir ~/hello-world //创建一个项目hello-world
$ cd ~/hello-world //打开这个项目
$ git init //初始化
$ touch README
$ git add README //更新README文件
$ git commit -m 'first commit' //提交更新,并注释信息“first commit”
$ git remote add origin git@github.com:username/hello-world.git //连接远程github项目
$ git push -u origin master //将本地项目更新到github项目上去
使用Github创建的过程
1、新建repo,copy git.io地址
2、$ git clone git.io地址
删除本地仓库:
find . -name ".git" | xargs rm -Rf
前提:
创建SSH Key。在用户主目录下,看看有没有.ssh目录,如果有,再看看这个目录下有没有id_rsa和id_rsa.pub这两个文件,如果已经有了,可直接跳到下一步。如果没有,打开Shell(Windows下打开Git Bash),创建SSH Key:
$ ssh-keygen -t rsa -C "youremail@example.com"
网友评论