当前位置: 首页 > news >正文

git本地搭建服务器[Vmware虚拟机访问window的git服务器]

先按照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 originFetch URL: http://shun@192.168.43.57:8080/gitblit/r/R528_Linux.gitPush  URL: http://shun@192.168.43.57:8080/gitblit/r/R528_Linux.gitHEAD branch: masterRemote branch:master trackedLocal branch configured for 'git pull':master merges with remote masterLocal 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是正常的!

http://www.lryc.cn/news/212666.html

相关文章:

  • 【Python】基础练习题
  • 语雀故障与反思,顺便再领半年会员!
  • PYTHON利用SQLAlchemy库高效操作关联的数据表
  • TypeScript中的类型工具
  • File --JAVA
  • 比较Excel中的两列目录编号是否一致
  • pgsql 创建自增ID , 指定自增ID起始值
  • 数据安全的重要性:如何解密[thekeyishere@cock.li].Elbie勒索病毒
  • 图像识别在自动驾驶汽车中的决策规划与控制策略研究。
  • Spring MVC 的责任链模式
  • 提升用户体验的关键步骤
  • 本地模拟,服务器下载文件
  • 如何防止Shopee账户关联
  • Java 入门指南:使用 Docker 创建容器化 Spring Boot 应用程序
  • Leetcode 542. 01 矩阵
  • 分享一下微信小程序抽奖链接怎么做
  • MathType2024破解版激活序列号
  • 简述对 Spring MVC 的理解
  • Redis——哨兵模式与Zookeeper选举的异同点
  • 基于 Center 的 3D 目标检测和跟踪
  • 华锐技术何志东:证券核心交易系统分布式改造将迎来规模化落地阶段
  • 数据结构 -- ArrayList与LinkedList的区别
  • 豪车托运为什么选小板
  • 【base64加密】js/ts的基础加密
  • 基于python的app程式开发
  • Spring Event学习
  • UE4 HLSL学习笔记
  • 报文的路由过程
  • 【CPP】类和对象
  • 【多线程面试题二十】、 如何实现互斥锁(mutex)?