八、部署java项目-创建私有仓库
java的项目是需要编译和打包的;编译和打包用maven完成,所以需安装maven
本次实验,我们采用git私有仓库的形式,涉及到配置密钥
准备工作:
- 自己申请一个私有git仓库(到https://github.com/上注册并创建)
- 生成密钥对
- 把公钥放到git服务端
- 下载zrlog的源码 https://codeload.github.com/94fzb/zrlog/zip/master
- 下载的文件为zip压缩文件,需要解压
- 然后用git push到新建的私有仓库里
到https://github.com/注册一个账号,创建一个仓库;点击+号,New repository。
设置密钥,点击头像的倒三角,选择setting
在Linux主机上生成ssh公钥:
[root@server ~]# ssh-keygen
[root@server ~]# cat .ssh/id_rsa.pub
把公钥的内容添加到:
添加成功如下:
将仓库克隆到/home目录;初始化并创建测试文件并推送
[root@server ~]# cd /home
[root@server home]# git clone git@github.com:xou6363/test_java
正克隆到 'test_java'...
The authenticity of host 'github.com (13.229.188.59)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
RSA key fingerprint is MD5:16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes //注意输入YES,只输Y老提示联系不上GIT仓库;
Warning: Permanently added 'github.com,13.229.188.59' (RSA) to the list of known hosts.
warning: 您似乎克隆了一个空版本库。
初始化并创建测试文件并推送:
[root@server test_java]# echo 1234