安装git
一、安装
如果你想在 Linux 上用二进制安装程序来安装 Git,可以使用发行版包含的基础软件包管理工具来安装。 如果以 Fedora 上为例,你可以使用 yum:
$ sudo yum install git
如果你在基于 Debian 的发行版上,请尝试用 apt-get:
$ sudo apt-get install git
要了解更多选择,Git 官方网站上有在各种 Unix 风格的系统上安装步骤,网址为 http://git-scm.com/download/linux。
二、设置用户信息
当安装完 Git 应该做的第一件事就是设置你的用户名称与邮件地址。 这样做很重要,因为每一个 Git 的提交都会使用这些信息,并且它会写入到你的每一次提交中,不可更改:
gitconfig–globaluser.name“JohnDoe” git config –global user.email johndoe@example.com
再次强调,如果使用了 –global 选项,那么该命令只需要运行一次,因为之后无论你在该系统上做任何事情, Git 都会使用那些信息。 当你想针对特定项目使用不同的用户名称与邮件地址时,可以在那个项目目录下运行没有 –global 选项的命令来配置。
很多 GUI 工具都会在第一次运行时帮助你配置这些信息。
使用git
一、使用git连接github
使用git连接github时,需要将linux下产生的一个ssh公钥放到github上。
ssh-keygen -t rsa -C”763604xx6@qq.com”
二、开始使用
1.新建一个repository
登陆github网站,点击create repository.
三、git相关命令
git help ——–git的相关命令
检查配置信息
如果想要检查你的配置,可以使用 git config –list 命令来列出所有 Git 当时能找到的配置。
$ git config --list
user.name=John Doe
user.email=johndoe@example.com
color.status=auto
color.branch=auto
color.interactive=auto
color.diff=auto
单个检查 git config user.name
四、相关网站
git官网文档:http://git-scm.com/doc