阿里云服务器使用github的简单介绍-成都快上网建站

阿里云服务器使用github的简单介绍

如何将阿里云申请的SSL证书部署到github上的静态服务器上

一、Gworg申请SSL证书

目前创新互联已为近1000家的企业提供了网站建设、域名、虚拟主机、网站托管、服务器托管、企业网站设计、文登网站维护等服务,公司将坚持客户导向、应用为本的策略,正道将秉承"和谐、参与、激情"的文化,与客户和合作伙伴齐心协力一起成长,共同发展。

二、登陆github帐户。点击你的头像,然后 Settings - 左栏点击 SSH and GPG keys - 点击 New SSH key,然后你复制上面的公钥内容,粘贴进“Key”文本域内。 title可自定义。

三、点击 Add key。

四、测试连接

Github Action 部署到阿里云ECS

ACCESS_TOKEN

阿里云服务器要部署你本机的公钥/root/.ssh/authorized_keys,这里的私钥才能使用

可以在阿里云服务器商添加密钥对,导入本机上的id_rsa_pub公钥,这个存放在.ssh/下面,然后重启实例之后,使用本机的id_rsa私钥配置到access_token里面

注意,更改为密钥对后,就会禁用网页上的密码登录,需要自己通过ssh进入/etc/ssh/sshd_config 下面修改

PermitRootLogin yes

PasswordAuthentication yes

才能使用

REMOTE_HOST

ip

REMOTE_TARGET

文件夹 /web

REMOTE_USER

root

阿里云服务器 怎么用git部署代码

使用阿里云Ubuntu 12.0.4 64位操作系统做git服务器。

首先git服务器有两种访问方式可以选择:http方式和ssh的方式,http方式更容易使用。

1、http方式的git服务器搭建以及使用git命令行访问:

On the Server

1) Install Ubuntu Server, this is the base of our git server obviously

2) Now we need to install a couple of packages, these being ‘git-core’ and ‘apache2′, we do this like so:-

apt-get update

apt-get install apache2 git-core

3) Now we need to create a new folder for your new repository and set some inital permissons, we do this like so:-

cd /var/www

mkdir test-repo.git

cd test-repo.git

git --bare init

git update-server-info

chown -R www-data.www-data .

4) We now need to enable WebDAV on Apache2 of which we will use to serve the repository:-

a2enmod dav_fs

5) We now need to configure the access restrictions to our repository by creating the following file:-

/etc/apache2/conf.d/git.conf

Then fill it in with the following content:-

Location /test-repo.git

DAV on

AuthType Basic

AuthName "Git"

AuthUserFile /etc/apache2/passwd.git

Require valid-user

/Location

Then save and close the file, lets move on to the next bit..

6) Next we need to create a user account of which you will need to use to browse of commit to the repository..

htpasswd -c /etc/apache2/passwd.git user

You could then be prompted to enter the password for the user too and confirm it!

7) Ok that’s it for the server side configuration… we just need to restart Apache2 like so and then we should be ready to move on to the client side stuff!

/etc/init.d/apache2 restart

…you can now move on to the client side stuff!

On the client side

Ok so now we need to create a local (on your desktop machine) repository and then we’ll initiate the new remote repository… So, if your using Linux/MacOSX bring up the terminal and type the following commands:-

mkdir ~/Desktop/test-project

cd ~/Desktop/test-project

git init

git remote add origin ;user@server name or IP address/test-project.git

touch README

git add .

git commit -a -m “Initial import”

git push origin master

Done! – Your intiial file named ‘README’ which currently is just blank has now been committed and you’ve pushed your code to your new git server which has now completed the Git reposity creation process, now in future you can ‘clone’ your resposity like so:-

git clone user@server name or IP address/test-project.git

注意上面连接;user@server name or IP address/test-project.git中的user就是你htpasswd -c /etc/apache2/passwd.git user输入的用户名。

另外新建仓库的时候,只需执行:

cd /var/www

mkdir 项目名

cd 项目名

git --bare init

git update-server-info

chown -R www-data.www-data .

然后在/etc/apache2/conf.d/git.conf中对应添加上面类似段即可。

其中:

AuthUserFile 密码文件名

后面的文件就是你指定的密码文件,你可以

htpasswd -c 密码文件名 user

对应指定该项目的用户名和密码即可。添加用户是不要-c参数:

htpasswd 密码文件名 user


名称栏目:阿里云服务器使用github的简单介绍
转载源于:http://kswjz.com/article/ddosgcs.html
扫二维码与项目经理沟通

我们在微信上24小时期待你的声音

解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流