github傻瓜的食用方法

git

配置Git

  1. 首先在本地创建ssh key;
    1
    $ ssh-keygen -t rsa -C "[email protected]"

后面的[email protected]改为你在github上注册的邮箱,之后会要求确认路径和输入密码,我们这使用默认的一路回车就行.成功的话会在~/下生成.ssh文档夹,进去,打开id_rsa.pub,复制里面的key.

  1. 回到github上,进入 Account Settings(账户配置),左边选择SSH Keys,Add SSH Key,title随便填,粘贴在你电脑上生成的key.

  2. 为了验证是否成功,在git bash下输入:

    1
    $ ssh -T git@github.com

如果是第一次的会提示是否continue,输入yes就会看到:You’ve successfully authenticated, but GitHub does not provide shell access .这就表示已成功连上github.

  1. 接下来我们要做的就是把本地仓库传到github上去,在此之前还需要设置username和email,因为github每次commit都会记录他们.
1
大专栏  github傻瓜的食用方法pan class="line">2
$ git config --global user.name "your name"
$ git config --global user.email "[email protected]"

将一个已有的工程上传到github的最简便方法

  • 到github上去新建一个当前工程命名的仓库
  • 执行git clone 新建的仓库地址

    1
    git clone @github.com:spygg/xxxx.git
  • 将工程下的所有文档拷贝到上一步xxx目录中

  • 执行命令三部曲
    1
    2
    3
    git add .
    git comment -m "说明xxxxxxxxxx"
    git push

ps

  • 更新仓库还是命令三部曲
  • 如果系统是windows请自行安装git(我是ubuntu自带的,自豪一下(^__^)

猜你喜欢

转载自www.cnblogs.com/lijianming180/p/12014084.html