先按照https://zhuanlan.zhihu.com/p/494988089說明下載好Gitblit然后復(fù)制到tomcat的webapps目錄下,如下:
雙擊"startup.bat"啟動tomcat:
然后訪問"http://127.0.0.1:8080/gitblit/"即可看到git的界面:
說明git服務(wù)器已經(jīng)能夠成功運行了!
Vmware虛擬機訪問window的git服務(wù)器
從這里https://blog.csdn.net/weixin_44033210/article/details/122986997得到靈感,關(guān)閉掉:
虛擬機這邊使用橋接的方式進行聯(lián)網(wǎng):
這時候虛擬機就可以訪問window的git服務(wù)器:
提交代碼的時候會遇到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'.
注意:因為使用的是橋接模式,這時候必須保證網(wǎng)絡(luò)是連接的,否則虛擬機沒有IP了!
推送成功后可以在git服務(wù)器看到代碼:
在git的服務(wù)器文件夾里面也看到有占用空間了:
說明整個git是正常的!文章來源:http://www.zghlxwxcb.cn/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/是正常沒問題的
至于為啥原來的端口訪問不了這里也不清楚文章來源地址http://www.zghlxwxcb.cn/news/detail-714509.html
到了這里,關(guān)于git本地搭建服務(wù)器[Vmware虛擬機訪問window的git服務(wù)器]的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!