今天有时间研究一下git,写完python的代码想分享到coding.net上去。但是用centos自带的1.7的版本的总是有问题。用源码包的方式安装一个1.9版本的。终于把代码传上去了。Git先掌握基本的使用功能,在本贴中后续再慢慢补充其他功能,先介绍源码安装。
Git 的工作需要调用 curl,zlib,openssl,expat,libiconv 等库的代码,所以需要先安装这些依赖工具
yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-devel
cd /usr/local/src
wget https://www.kernel.org/pub/software/scm/git/git-1.9.4.tar.gz
tar xf git-1.9.4.tar.gz
cd git-1.9.4
make prefix=/usr/local/git all
make prefix=/usr/local/git install
rm -rf /usr/bin/git
ln -s /usr/local/git/bin/git /usr/bin/git
我要上传的项目在/usr/local/mysite中,传到coding.net需要做如下操作:
cd /usr/local/mysite
git init
git remote add mysite https://git.coding.net/wangdi244/mysite.git
git add * (这里需要添加想上传的文件或目录)
git commit -m “mysite”
git push mysite master
推送成功后会有如下显示:
[root@localhost mysite]# git push mysite master
Username for ‘https://git.coding.net‘: wangdi244
Password for ‘https://wangdi244@git.coding.net‘:
Counting objects: 43, done.
Compressing objects: 100% (39/39), done.
Writing objects: 100% (43/43), 14.51 KiB | 0 bytes/s, done.
Total 43 (delta 2), reused 0 (delta 0)
To https://git.coding.net/wangdi244/mysite.git
* [new branch] master -> master
参考资料:
http://blog.chinaunix.net/xmlrpc.php?r=blog/article&uid=25150840&id=4250659
http://tecadmin.net/install-git-1-9-on-centos-rhel/
原文地址:http://881955.blog.51cto.com/871955/1699561