本文主要是介绍linxu自动化编译之git安装和使用,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
git常见命令
http://www.cnblogs.com/cspku/articles/Git_cmds.html
第一步:git下载
下载地址:https://www.kernel.org/pub/software/scm/git/
第二步:解压缩和安装
2.1解压缩
tar -xvf git-1.8.3.4.tar.gz
2.2安装设置环境变量
vim /etc/profile
追加文件:
GIT_HOME=/usr/local/git-1.8.3.4
export GIT_HOME
export PATH=${PATH}:${GIT_HOME}/bin
2.3更新环境变量
source /etc/profile
2.4检查安装成功
git --version
第三步:关联github
3.1生成密钥
ssh-keygen -t rsa -C "your gitbub email"
注意会提醒你生成的id_rsa.pub地址例如:
[root@iZwz9dxalf5enusvfvarnsZ local]# ssh-keygen -t rsa -C "XXXXX@sina.cn"
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:
Passphrases do not match. Try again.
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:
82:9e:4e:c8:f1:7c:f9:6f:c6:f4:45:a9:ef:10:8a:49 XXXXX@sina.cn
The key's randomart image is:
+--[ RSA 2048]----+
| |
| |
| . |
| . o |
| . . . E .o |
| . * . + o..... |
| o * o oo...o |
| o . . + ... |
| . .+. .. |
+-----------------+
3.2设置github秘钥
3.2.1进入/root/.ssh/id_rsa复制生成的秘钥
3.2.2登录你自己的github,黏贴秘钥
可以关联使用github项目了
注意:
在git push时会发生错误
[root@iZwz9dxalf5enusvfvarnsZ mq]# git push
error: The requested URL returned error: 403 while accessing https://github.com/XXX/mq.git/info/refs
方案:
修改vim .git/config
修改前
[remote "origin"]
url = https://github.com/XXXX/mq.git
修改后
[remote "origin"]
url = https://XXXX@github.com/XXXX/mq.git
这篇关于linxu自动化编译之git安装和使用的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!