本片博文主要介绍如何在window上使用git提交代码到github。

一、安装git

      在如下网址中下载安装即可。

      https://gitforwindows.org/

      安装成功后界面为:

     git学习笔记之环境搭建

二、git 简单命令操作

       (1)、因为git是分布式系统,所以需要填写用户名和邮箱作为标识。git config  –global 参数,有了这个参数,表示你这台                      设备上所有的Git仓库都会使用这个配置,当然你也可以对某个仓库指定的不同的用户名和邮箱。

                    git config --global user.name "lixn"

                    git config --global user.mail "[email protected]"

        (2)、通过命令 git init 把这个目录变成git可以管理的仓库,如下:

                    git init

        (3)、git 命令

                    git add

                    git commit

 三、github配置

        (1)、登录github(https://github.com

        (2)、创建repository(仓库)

                    git学习笔记之环境搭建   git学习笔记之环境搭建

Repository name 安装自己需要写即可,Description简单描述仓库的作用即可。

  git学习笔记之环境搭建   

   (3)、添加ssh keys

               首先检查是否已生成** cd ~/.ssh,ls如果有3个文件,则**已经生成,id_rsa.pub就是公钥

               git学习笔记之环境搭建

              如果没有生成,那么通过$ ssh-****** -t rsa -C “[email protected]”来生成。

               1 2 3处直接回车即可

              git学习笔记之环境搭建

        

 

git学习笔记之环境搭建

将id_rsa.pub中的内容,拷贝到下图key中即可。

git学习笔记之环境搭建

四、将本地工程push到github

      关联远程账户

      git remote add origin [email protected]:yourname/yourproject.git

      把本地库的所有内容推送到远程库上

       git push -u origin master 

git学习笔记之环境搭建

 

参考网址:

https://blog.csdn.net/u010802169/article/details/80490886

https://blog.csdn.net/dongxiaocong/article/details/81316343

相关文章: