关于gitlab的一个问题解决

这两天折腾一个关于gitlab的问题,搞得比较焦头烂额。不过通过折腾,最终仍是成功了。html

当面对着一个问题,而且看到还没被解决的时候,感受很不舒服;linux

努力折腾以后,解决以后,也会身体轻松。或许工程师天生就是"不解决问题不舒服斯基"。这是很差的习惯,之后要改。这里简要记录一下。git

一.产生的问题描述:github

  前两天同事本身在gitlab上面建立了一个仓库,http://121.201.13.32:9000/sbzhou/tsd-collector.git,因为全部peoject都基本是统一的前缀 http://121.201.13.32:9000/xiaobao/(例如http://121.201.13.32:9000/xiaobao/tsd-thirdparty.git),为了协调和统一性,咱们建议统一管理:重建peojectshell

  操做步骤1.,我首先经过gitlab去transfer project,结果发现transfer以后,他没法提交;服务器

  因而只好从新再次create project,create以后,上传他原来的project code,依然会存在问题。app

HaoChuang@LENOVO-PC /E/test/suyx/tsd-collect (master)
$ git push -u origin master
Username for 'http://121.201.13.32:9000': suyx
Password for 'http://suyx@121.201.13.32:9000':
Counting objects: 8, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 553 bytes | 0 bytes/s, done.
Total 6 (delta 4), reused 0 (delta 0)
remote: GitLab: You don't have permission
To http://121.201.13.32:9000/xiaobao/tsd-collect.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'http://121.201.13.32:9000/xiaobao/tsd-collec
t.git'

二.解决过程:ide

1.查看系统配置,发现,这里说一下,同窗们安装gitlab的时候,能够才用这个安装: bitnami-gitlab-7.6.2-0-linux-x64-installer.rungitlab

你能够经过以下命令启动: ./ctlscript.sh startspa

另外,查看日志的话,能够去该位置查看:/home/git/gitlab-shell/gitlab-shell.log

/opt/gitlab-7.6.2-0/apps/gitlabci/htdocs/log/sidekiq.log

部分配置文件,能够根据这里查找:/opt/gitlab-7.6.2-0/properties.ini

参考:http://www.koofun.com/showcode.html?id=29706&l=en

 

这里标记几个经常使用的命令,供各位参考:

Git global setup

git config --global user.name "haochuang"
git config --global user.email "hao@aituyou.com"

Create a new repository

mkdir tsd-collect
cd tsd-collect
git init
touch README.md
git add README.md
git commit -m "first commit"
git remote add origin git@121.201.13.32:xiaobao/tsd-collect.git
git push -u origin master

Push an existing Git repository

cd existing_git_repo
git remote add origin git@121.201.13.32:xiaobao/tsd-collect.git
git push -u origin master

三.最终解决办法:

1.提高设备的配置;

2.修改了部分配置文件,增大了资源配置,确保http连接可用;

3.清除重复repo,确保服务器端干净;

4.重建git仓库,从新清理和检查、调整权限;

 

四.问题缘由分析和回顾:

  参考:https://bitbucket.org/site/master/issues/7522/remote-rejected-master-master-pre-receive

  重复会致使问题;

      须要添加SSH Public Key 到你的 GitLab:http://stackoverflow.com/questions/27457540/gitlab-password-and-permission

 

五.操做备注:

备注1:在第一次建立工程的时候,记得先做以下操做:

git remote add  origin git@github.com:<your name>/<appname>
第一次须要origin,添加repository,以后才向repository push你的代码。
通常是push到github以后,再git push master部署到master上。

备注2:在使用git的时候,要了解git的基本使用flow,并且团队中尽量让全部人都能正常了解和使用:

https://about.gitlab.com/2014/09/29/gitlab-flow/

 

备注3:对于工程的建立和删除,最好是统一管理。

固然,最好的是公司能有本身的SCM人员,省得因为部分人操做失误,出现问题以后,耽误其余工程师帮忙修复,耽误时间。

PS:对于一些号称工做了15年,却只会作点传话筒的事情,只会用TororsieSVN GUI提交代码,连git都用很差,用了也还个你挖坑,在工做中尽可能与这种人越远越好,省得受其影响,被带出坏习惯 :-)

相关文章
相关标签/搜索