阿里云、腾讯云、远程服务器配置github连接
Git, Linux
首先配置git参数:
git config --global user.name "****" git config --global user.email "****@qq.com" cd existing_folder git init git remote add origin git@code.aliyun.com:451750780/momodai.git git add . git commit git push -u origin master
添加SSH:
我们需要在阿里云code的账号下添加工作pc对应的ssh已获得对项目管理的各种权限,在阿里云code的帮助中有添加ssh的简单教程。
在git bash中输入获取公钥的指令:
cat ~/.ssh/id_rsa.pub
如果看到一长串以 ssh-rsa或 ssh-dsa开头的字符串,说明已经存在本地公钥(但似乎在创建公钥时需要对应阿里云code的账号,所以我们可以创建一个新的本地公钥)。
继续在git bash中输入:
ssh-keygen -t rsa -C "your account"
点击回车使用默认值,或者可以输入存放键值对和密码的位置和文件名。结束之后继续输入获取公钥的指令来获取公钥:
将取得的如图所示的公钥从ssh开始复制
添加SSH的地方:
进入https://code.aliyun.com将公钥贴到阿里云平台上面,即可远程操作GitHub代码库。
一般内部开发,自己服务器上的代码需要手动去执行,不需要连接终端拉取代码的情况,可以使用网页方式访问。
使用PHP文件拉取git更新
1.PHP文件内容:
<?php system('/bin/bash ../../update.sh'); system('/usr/bin/git log -n 1|head -n 1');
2.sh脚本内容(update.sh):
#!/bin/bash bin_git=/usr/bin/git branch=develop $bin_git checkout $branch $bin_git pull origin $branch
3.id_rsa.pub公钥文件转pem文件:
ssh-keygen -f id_rsa.pub -e -mPKCS8 > public.pem
4.id_rsa密钥文件转pem文件:
openssl rsa -in id_rsa -text > private.pem
Jocsonme
Good Day !
Good good study, day day up !
Related Posts
分类目录
- Apache (6)
- APP-Android (1)
- APP-IOS (3)
- BI (2)
- Qlikview (2)
- BigData (2)
- Domain-Space (1)
- Git (4)
- Google (1)
- History – Articles (2)
- HTML+CSS (13)
- IDE-CodeEditor (1)
- NetBeans (1)
- Javascript (18)
- Linux (24)
- Load-Balancing (3)
- Memcached (1)
- MySQL (9)
- PHP (28)
- Laravel (1)
- Swoole (1)
- Symfony2.x – 3.x (2)
- ThinkPHP5 (1)
- Thirdpart – develop (6)
- ZendFramework2.x (1)
- Products-Design (1)
- Redis (1)
- SEM (2)
- SEO (2)
- Server-Architecture (5)
- Vagrant (1)
- Windows (7)
- BAT (1)
- Workplace (1)
一 | 二 | 三 | 四 | 五 | 六 | 日 |
---|---|---|---|---|---|---|
« 11月 | ||||||
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |