centos 7 自建git服务器 gitblit建立
本地代码推送到远程git仓库上
本地git分支关联到远程分支
$ git remote add origin http://admin@185.239.226.111:9111/r/thinkcmf-zlh.git
推送到远程
git push -u origin master 正常这个就可以不过遇到这样的错误 用下面的

git push -u origin master –f
http://185.239.226.111:9111/
出现
fatal: remote origin already exists.
解决办法
git remote rm origin

出现

Everything up-to-date
Branch master set up to track remote branch master from origin.
解决办法
$ git add .
$ git commit -m '2222'
[master 88d99fb] 2222
4 files changed, 43 insertions(+), 38 deletions(-)
$ git push origin master
Counting objects: 16, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (16/16), done.
Writing objects: 100% (16/16), 1.77 KiB | 0 bytes/s, done.
Total 16 (delta 12), reused 3 (delta 0)
remote: Resolving deltas: 100% (12/12)
remote: Updating references: 100% (1/1)
To http://185.239.226.111:9111/r/thinkcmf-zlh.git
4bdb66a..88d99fb master -> master

文件提交后才能看出来,本地也能看到文件没有更新到最新,必须提交commit才能看出 一直push说跟远程版本一样 没有改动

git push -u origin master

查看分支

参考资料
问题1 : fatal: Couldn't find remote ref master
解决办法:
Gitblit 管理工具安装
1.安装java jdk
yum search jdk
yum install -y java-1.8.0-openjdk.x86_64
java -version 查看版本 安装成功有显示

2. 解压gitblit 配置http和https启动端口
进入到gitblit下载目录 我的是/git/gitblit/src
执行解压
[root@xs185239226111 src]# tar -zxvf gitblit-1.8.0.tar.gz

进入解压目录
cd gitblit-1.8.0

进入data目录 配置信息

编辑gitblit.properties文件
vi gitblit.properties
按I健
添加
server.httpPort = 7000
server.httpsPort = 7001

ESC 然后 :wq回车
3.
回到data上级目录 找到service-centos.sh

编辑vi servie-centos.sh
#!/bin/bash
# chkconfig: 3 21 91
# description: Starts and Stops gitblit
# Source function library.
. /etc/init.d/functions
# change theses values (default values)
GITBLIT_PATH=/git/gitblit/src/gitblit-1.8.0
GITBLIT_BASE_FOLDER=/git/gitblit/src/gitblit-1.8.0/data
GITBLIT_HTTP_PORT=7000
GITBLIT_HTTPS_PORT=7001
GITBLIT_LOG=/git/gitblit/src/log/gitblit.log
source ${GITBLIT_PATH}/java-proxy-config.sh
JAVA="java -server -Xmx1024M ${JAVA_PROXY_CONFIG} -Djava.awt.headless=true -jar"

按I健插入模式 改上面的路径,然后ESC 输入:wq
在当前目录把配置文件复制到启动目录里
[root@xs185239226111 gitblit-1.8.0]# cp service-centos.sh /etc/init.d/gitblit

添加启动服务
[root@xs185239226111 gitblit-1.8.0]# chkconfig --add gitblit
启动服务
[root@xs185239226111 gitblit-1.8.0]# java -jar gitblit.jar --baseFolder data
ctrl + z推出当前

查看服务是否启动
ps -ef | grep gitblit

直接浏览器访问 http://185.239.226.111:7000/ 记得防火墙把端口开一下
http端口尽量选择一个没有占用的
默认账号密码 admin / admin

查看自启动

停止服务命令(stop start restart )
service stop gitblit
systemctl stop gitblit
启动gitblit服务
service gitblit start

问题1:Your local changes to the following files would be overwritten by merge:
08:36:09.758: [cmf] git -c core.quotepath=false -c log.showSignature=false pull --progress --no-stat -v --progress origin master
From http://185.239.226.111:9111/r/thinkcmf-zlh
* branch master -> FETCH_HEAD
= [up to date] master -> origin/master
error: Your local changes to the following files would be overwritten by merge:
public/themes/ziding1/portal/article.html
public/themes/ziding1/portal/index.html
public/themes/ziding1/portal/index.json
public/themes/ziding1/portal/list.html
public/themes/ziding1/public/footer.html
public/themes/ziding1/public/head.html
public/themes/ziding1/public/nav.html
simplewind/cmf/controller/HomeBaseController.php
Please commit your changes or stash them before you merge.
error: The following untracked working tree files would be overwritten by merge:
public/phpinfo.php
public/static/images/call.png
public/static/images/copyright.png
public/static/images/email.png
public/static/images/index_companyintro_img.jpg
public/static/images/logo1.png
public/static/images/qr.jpg
public/themes/ziding1/public/assets/css/pagecss.css
Please move or remove them before you merge.
Aborting
解决办法
先git add .
git commit -m '信息'
然后git pull origin master
网上说的那些保存状态真的不行,应该都没有分清什么状态下用
参考资料
http://www.gitblit.com/

浙公网安备 33010602011771号