关键词:java, git ,windows, linux ,局域网git
一.安装Java下载地址:https://www.java.com/zh-CN/
配置java环境变量路径:“电脑” -> “属性” -> “高级系统设置” -> “高级” -> “环境变量” 中的“系统变量”。
-
新建JAVA_HOME
变量名:JAVA_HOME
变量值:根据自身的安装路径
-
新建CLASSPATH
变量名:CLASSPATH
变量值:% JAVA_HOME%/lib/dt.jar;%JAVA_HOME%/lib/tools.jar -
添加Path变量
- 下载地址:http://gitblit.github.io/gitblit/
- 解压下载的包,无需安装,但路径最好如下图所示。
- 在D盘下创建33.git的文件夹,并进入gitblit-1.8.0data,编辑defaults.properties文件,填写仓库存储路径地址,并修改server.httpPort,server.httpsPort,server.httpBindInterface,server.httpBindInterface,server.certificateAlias。其中httpPort和httpsPort是端口号,httpBindInterface是你电脑本机ip地址。
# Standard http port to serve. <= 0 disables this connector. # On Unix/Linux systems, ports < 1024 require root permissions. # Recommended value: 80 or 8080 # # SINCE 0.5.0 # RESTART REQUIRED server.httpPort = 80 # Secure/SSL https port to serve. <= 0 disables this connector. # On Unix/Linux systems, ports < 1024 require root permissions. # Recommended value: 443 or 8443 # # SINCE 0.5.0 # RESTART REQUIRED server.httpsPort = 83 # Automatically redirect http requests to the secure https connector. # # This setting requires that you have configured server.httpPort and server.httpsPort. # Unless you are on a private LAN where you trust all client connections, it is # recommended to use https for all communications. # # SINCE 1.4.0 # RESTART REQUIRED server.redirectToHttpsPort = false # Specify the interface for Jetty to bind the standard connector. # You may specify an ip or an empty value to bind to all interfaces. # Specifying localhost will result in Gitblit onLY listening to requests to # localhost. # # SINCE 0.5.0 # RESTART REQUIRED server.httpBindInterface = 192.168.137.1 # Specify the interface for Jetty to bind the secure connector. # You may specify an ip or an empty value to bind to all interfaces. # Specifying localhost will result in Gitblit onLY listening to requests to # localhost. # # SINCE 0.5.0 # RESTART REQUIRED server.httpsBindInterface = 192.168.137.1 # Alias of certificate to use for https/SSL serving. If blank the first # certificate found in the keystore will be used. # # SINCE 1.2.0 # RESTART REQUIRED server.certificateAlias = localhost
- 如果你电脑是32位机,修改gitblit-1.8.0data的installService.cmd为SET ARCH=x86,否则SET ARCH=amd64
- 安装win服务
- 确保为“自动”模式
- 设置防火墙规则以确保局域网中的其他机器可以访问服务器。
- 浏览器输入 上面配置文件中的ip及端口,并修改账号和密码,开始的账号和密码都是“admin”
- 添加用户
- 然后将用户名和初始密码发送给团队成员登录
参考链接:跳转
- 创建版本库,获得ssh连接。
- 在另一台电脑生成ssh公钥,比如我的是ubuntu,生成ssh方法如下
1). 设置git的user.name和user.email
git config --global user.name "xxx" git config --global user.email "xx@xx.com"
2). 生成ssh key,简便做法就是直接按“回车”
ssh-keygen -t rsa
3).查看生成的ssh key,用来复制,复制ssh-rsa后部分即可
cat ~/.ssh/id_rsa.pub
3. 在网站上添加用户ssh,把上面得到的ssh添加进ssh key即可
4. 在ubuntu端克隆版本库,找到版本库url,在ubuntu的某目录下使用git clone “你的url”,进行克隆,这时候是空目录,往里面添加源码等文件,在使用git操作,进行代码提交即可。
git操作提示:
git add . #添加目录下所有文件 git commit -m "修改说明" #进行提交 git push #推到仓库



