美文网首页
Mac下使用GitHub使用过程中遇到的错误总结!

Mac下使用GitHub使用过程中遇到的错误总结!

作者: ZPengs | 来源:发表于2016-07-23 15:30 被阅读356次

1、git的使用方法介绍:git教程

1.1、 安装

 1.下载安装git客户端 [http://code.google.com/p/git-osx-installer/downloads/list?can=3](http://code.google.com/p/git-osx-installer/downloads/list?can=3)
 2.注册github账号 https://github.com/ -->Pricing and Signup -->Create a free account

1.2、创建ssh:

 1. 打开终端(在spotlight里搜terminal):   
 2.  $cd ~/.ssh //检查是否已经存在ssh
  如果存在,先将已有的ssh备份,或者将新建的ssh生成到另外的目录下
  如果不存在,通过默认的参数直接生成ssh:
        $ssh-keygen -t rsa -C xxxxx@gmail.com(注册github时的email)
        Generating public/private rsa key pair.
        Enter file in which to save the key (/Users/twer/.ssh/id_rsa): 
        Created directory '/Users/twer/.ssh'.
        Enter passphrase (empty for no passphrase): 
        Enter same passphrase again: 
        Your identification has been saved in /Users/twer/.ssh/id_rsa.
        Your public key has been saved in /Users/twer/.ssh/id_rsa.pub.
        The key fingerprint is:
        18:16:11:c9:01:6c:48:09:7f:27:c6:43:0d:7f:3f:84 xxxxx@gmail.com
        The key's randomart image is:
        +--[ RSA 2048]----+
        |.o.++===         |
        |.ooo.+. .       |
        |  ..* = E .      |
        |   o = + o       |
        |      . S o      |
        |           .     |
        |                 |
        |                 |
        |                 |
       +-----------------+

1.3、在github中添加ssh

 1. 登陆github,选择Account Settings-->SSH  Keys 添加ssh
   Title:xxxxx@gmail.com
   Key:打开你生成的id_rsa.pub文件,将其中内容拷贝至此。

1.4、 添加.gitignore忽略指定文件

1、 cd "进入项目所在目录。"
2、输入 touch .gitignore 在文件夹就生成了一个“.gitignore”文件。
3、然后在”.gitignore” 文件里输入你要忽略的文件夹及其文件就可以了。
4、配置语法:
  以斜杠“/”开头表示目录;
  以星号“*”通配多个字符;
  以问号“?”通配单个字符
  以方括号“[]”包含单个字符的匹配列表;
  以叹号“!”表示不忽略(跟踪)匹配到的文件或目录;
5、配置规则:
  5.1、过滤文件夹设置:
       /mtk/       表示过滤这个文件夹
  5.2、过滤文件设置:
       指定过滤某种类型的文件:
       *.zip
       *.rar
       *.via
       *.tmp
       *.err
       *.DS_Store   
  5.3、指定过滤某个文件:
        /mtk/do.c
        /mtk/if.h
  5.4、保守模式负责设置哪些文件不被过滤,也就是哪些文件要被跟踪。
       跟踪某个文件夹:
       !/plutommi/mmi
  5.5、跟踪某类文件:
       !*.c
       !*.h
   5.6、跟踪某个指定文件:
        !/plutommi/mmi/mmi_features.h

git多站点多用户情况下SSH配置

Git:fork 源仓库、fork 仓库副本和 local 仓库的同步

github使用详情见这里:

相关文章

网友评论

      本文标题:Mac下使用GitHub使用过程中遇到的错误总结!

      本文链接:https://www.haomeiwen.com/subject/zooljttx.html