先按照https://zhuanlan.zhihu.com/p/494988089说明下载好Gitblit然后复制到tomcat的webapps目录下,如下:
双击"startup.bat"启动tomcat:
然后访问"http://127.0.0.1:8080/gitblit/"即可看到git的界面:
说明git服务器已经能够成功运行了!
Vmware虚拟机访问window的git服务器
从这里https://blog.csdn.net/weixin_44033210/article/details/122986997得到灵感,关闭掉:
虚拟机这边使用桥接的方式进行联网:
这时候虚拟机就可以访问window的git服务器:
提交代码的时候会遇到ssh错误:
root@tina-virtual-machine:/home/workspace/tina-r528-v1.2# git push --set-upstream origin master
Unable to negotiate with 192.168.43.57 port 29418: no matching host key type found. Their offer: ssh-rsa,ssh-dss
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
后来实在没办法改远程仓库改成http:
root@tina-virtual-machine:/home/workspace/tina-r528-v1.2# git remote show origin
* remote origin
Fetch URL: http://shun@192.168.43.57:8080/gitblit/r/R528_Linux.git
Push URL: http://shun@192.168.43.57:8080/gitblit/r/R528_Linux.git
HEAD branch: master
Remote branch:
master tracked
Local branch configured for 'git pull':
master merges with remote master
Local ref configured for 'git push':
master pushes to master (up to date)
这时候提交代码就没有问题了:
root@tina-virtual-machine:/home/workspace/tina-r528-v1.2# git push --set-upstream origin master
Password for 'http://shun@192.168.43.57:8080':
Enumerating objects: 226298, done.
Counting objects: 100% (226298/226298), done.
Delta compression using up to 4 threads
Compressing objects: 100% (215476/215476), done.
error: RPC failed; curl 7 Couldn't connect to server
send-pack: unexpected disconnect while reading sideband packet
Writing objects: 100% (226298/226298), 5.51 GiB | 14.84 MiB/s, done.
Total 226298 (delta 52759), reused 0 (delta 0), pack-reused 0
fatal: the remote end hung up unexpectedly
Everything up-to-date
root@tina-virtual-machine:/home/workspace/tina-r528-v1.2# git push --set-upstream origin master
Password for 'http://shun@192.168.43.57:8080':
Enumerating objects: 226298, done.
Counting objects: 100% (226298/226298), done.
Delta compression using up to 4 threads
Compressing objects: 100% (162714/162714), done.
Writing objects: 100% (226298/226298), 5.51 GiB | 43.50 MiB/s, done.
Total 226298 (delta 52762), reused 226298 (delta 52762), pack-reused 0
remote: Resolving deltas: 100% (52762/52762)
remote: Updating references: 100% (1/1)
To http://192.168.43.57:8080/gitblit/r/R528_Linux.git
* [new branch] master -> master
Branch 'master' set up to track remote branch 'master' from 'origin'.
注意:因为使用的是桥接模式,这时候必须保证网络是连接的,否则虚拟机没有IP了!
推送成功后可以在git服务器看到代码:
在git的服务器文件夹里面也看到有占用空间了:
说明整个git是正常的!文章来源:https://www.toymoban.com/news/detail-714509.html
用eclipse启动tomcat
上面的方式是直接启动tomcat,这种方式有时候因为端口占用并不能够正常启动,但是看tomcat却没有没有问题,这里借助eclipse来启动tomcat:
这里右键启动
这里显示端口被占用:
这里不去研究端口为啥被占用,直接把端口改成8089再启动:
注意:修改端口后要按ctrl+s来保存
再次启动后log正常显示如下:
这时候访问http://127.0.0.1:8080/gitblit是没办法访问的
访问http://127.0.0.1:8089/gitblit/是正常没问题的
至于为啥原来的端口访问不了这里也不清楚文章来源地址https://www.toymoban.com/news/detail-714509.html
到了这里,关于git本地搭建服务器[Vmware虚拟机访问window的git服务器]的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!