linux centos上如何安装git并下载源码安装?

《linux centos上如何安装git并下载源码安装?》要点:
本文介绍了linux centos上如何安装git并下载源码安装?,希望对您有用。如果有疑问,可以联系我们。

现在git上有很丰富的开源软件,怎样简单地下载到你的linux centos上并安装执行?

下面按步骤来操作:

一、先创建创建github帐号 。如xxx@qq.com,然后:

(1)安装git

yum install git -y

(2)生成ssh key:

执行ssh-keygen -t rsa -C xxx@qq.com,如下

$ ssh-keygen -t rsa -C xxx@qq.com

Generating public/private rsa key pair.

Enter file in which to save the key (/root/.ssh/id_rsa):

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /root/.ssh/id_rsa.

Your public key has been saved in /root/.ssh/id_rsa.pub.

The key fingerprint is:

2e:db:7c:b9:e6:a4:a7:0f:04:bd:ad:4f xxx@qq.com

The key's randomart image is:

+--[ RSA 2048]----+

|                 |

|           .     |

|          . .    |

|           . o   |

|        S   o .  |

|       o   . .   |

|      . + o.o E  |

|       = O+ .+   |

|      ..B==+..o  |

+-----------------+

上面说明了公钥在 /root/.ssh/id_rsa.pub

(3)到github网页,在右上角选择setting—>SSH and GPG keys—>New SSH keys—>Title 取一个标识题,

Key一栏则把/root/.ssh/id_rsa.pub里面的内容完全复制进去

(建议用gedit打开,ctrl A全选–>ctrl c复制–>ctrl v 粘帖到key里面) ,注意不要复制空格。

最后会得到:

aliyun (这是你的标题)

Fingerprint: 2e:db:7c:b9:.....bd:ad:4f

(4)测试是否成功

# ssh -T git@github.com

如果出现

Are you sure you want to continue connecting (yes/no)? yes (这里输入yes)

Warning: Permanently added 'github.com,13.229.188.59' (RSA) to the list of known hosts.

Hi xxxxxx! You've successfully authenticated,but GitHub does not provide shell access.

那么表示已经成功连上github

(5)配置git的配置文件username和email

#配置用户名

$ git config --global user.name 我的用户名

#配置email

$ git config --global user.email 我的github所使用的注册邮箱

下载git包:

比如下载这个: https://github.com/Valloric/YouCompleteMe,可以通过这个网址来下载YouCompleteMe:

$ git clone https://github.com/Valloric/YouCompleteMe

也可以在用单引号将网址括住,效果是一样的:

$ git clone 'https://github.com/Valloric/YouCompleteMe'

注意网址用git上项目的URL或如图方式得到的地址均可:

linux centos上如何安装git并下载源码安装?

也可以将https改为git,例如:

git clone git://github.com/Valloric/YouCompleteMe

git clone 'git://github.com/Valloric/YouCompleteMe'

下载过程如图:

linux centos上如何安装git并下载源码安装?

下载后,就可以执行包安装,比如:

 $ composer install

 或npm等包安装。

 

 

 

 还可以建立分支:

 clone下来的代码还需我们建立分支,可以使用git checkout -b master 来建立一个主线分支,完全和github上面的相同;

 建立完成后,在使用git checkout -b master_sky ( 名称自己定义) 来建立自己的分支,这样就可以任意去修改源码了。如下图所示

相关文章

随着云计算和网络技术的发展,越来越多的数据需要在服务器之...
阿里云服务器Tomcat无法从外部访问一、环境阿里云Ubuntu 12....
购买一系列的东西其实就是花钱买块区域,服务器,域名,云解...
前言昨天买了域名,服务器,然后搭建了环境,然后想他通过默...
前言由于服务器centos6.8安装mysql一直出现不能连接问题,然后...
前言用 SSH客户端登录上以后,自己想要在本地连接服务器上的...