git 基础使用

1: 安装客户端

2: 注册使用github

3: 具体操作

3-1: 右键打开:git bash here 执行

    ssh-keygen -t rsa -C "youremail@example.com"

3-2: 然后 进入 C:UsersDadadawen.ssh 找到 id_rsa.pub 复制内容

3-3: 进入github.com

    点击: Tell us about yourself 意思是 告诉我们你自己

    点击:SSH keys  

    点击: News SSH key

    输入title:id_rsa.pub

    输入key: ctrl+v (粘贴刚才复制的ssh)

    点击: Add SSH key

3-4: 进入github.com

    点击 + New repository  意思是 新知识库

    进去 输入 name Description 选择是否公开

    点击 create Newrepository ,


3-5: 到此 github上的版本库已经搭建好了 你已经可以在你的本地操作了

3-6: 在github 上找到对应的 版本库地址 复制

3-7: 在本地 打开 git bash here

    执行 eg: git clone git@github.com:dadadawen/test_a.git

3-8: 出现类似 意思就是克隆成功了

    Cloning into 'test_a'...
    Warning: Permanently added the RSA host key for IP address '192.168.1.234' to the list of known hosts.
    remote: Counting objects: 6, done.
    remote: Compressing objects: 100% (3/3), done.
    remote: Total 6 (delta 0), reused 3 (delta 0), pack-reused 0
    Receiving objects: 100% (6/6), done.
    Checking connectivity... done.

3-9: git add a.txt

    会提示一个警告错误

    warning: LF will be replaced by CRLF in XXXXXXXXXXXXXX

    在bash here 运行

    git config core.autocrlf false

    这样 设置git配置后 在执行add操作就没有问题了

3-10: 执行 commit

    git commit -m 'dadadawen add a.txt';

3-11: 执行 push origin master

    git push 有以下提示就是执行成功

    Counting objects: 3, done.
    Delta compression using up to 4 threads.
    Compressing objects: 100% (2/2), done.
    Writing objects: 100% (3/3), 308 bytes | 0 bytes/s, done.
    Total 3 (delta 0), reused 0 (delta 0)
    To git@github.com:dadadawen/test_a.git
       b1eab40..71e466d  master -> master



更多的git资源 可以到www.liaoxuefeng.com
   

原文地址:https://www.cnblogs.com/laowenBlog/p/5354130.html