我的测试服务器上有一个git master分支testvps.subdomain.domain.com:~public_html/domain.com/ZendSkeletonApplication/.我现在在同一台服务器上运行Gitlab CentOS rpm并运行http://testvps.subdomain.domain.com:8888
我需要导入这个现有的本地库到Gitlab(参见克隆回购较早前的问题在这里使用ssh)相同的测试服务器上.这个repo是主分支而不是原始分支原点,它是Github上的ZendApplication.对于passworded访问,Gitlab建议像https://username:password@gitlab.com/company/project.git文档提到的链接将裸存储库复制到/ home/git /
用户git只是以某种方式添加了主目录未创建我想这必须手动完成 - 请参阅此处的链接.不确定是否需要进行适当的进口.这是一个主分支需要一种不同的方法来导入现有的git存储库,看起来有20多次提交.也许我应该让大师成为新的起源?我应该怎么做呢?
我已经添加了gitlab .git repo作为新的远程.
git remote set-url origin git@testvps.sub.domain.com:root/repo.git
git remote -v
origin git@testvps.sub.domain.com:root/repo.git (fetch)
origin git@testvps.sub.domain.com:root/repo.git (push)
Run Code Online (Sandbox Code Playgroud)
当我尝试推送它时,我收到了git用户密码的请求
git push -u origin master
git@testvps.sub.domain.com's password:
Run Code Online (Sandbox Code Playgroud)
这不应该是我需要的,也不应该.我怎样才能解决这个问题?
PS sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production无法正常工作,因为它缺少命令
在另一位服务器管理员的帮助下,我解决了问题。例如,我需要生成并添加 ssh 密钥,如http://www.codeproject.com/Articles/674637/How-to-passwordless-ssh中所述。不知何故,在安装 Gitlab 的过程中,这个问题没有得到解决。这样就生成了一个密钥并将其添加到授权密钥中:
ssh-keygen -t rsa
Generating public/private rsa key pair.
//store in home directory of user and then copy to authorized keys at destination
cat /user/.ssh/id_rsa.pub >> /var/opt/gitlab/.ssh/authorized_keys
Run Code Online (Sandbox Code Playgroud)
此外,Gitlab 存储库的路径不正确。所有存储库都位于此处:/var/opt/gitlab/git-data/repositories/我的存储库目前位于我的用户 jasper 之下,因此git@testvps.domain.com:/var/opt/gitlab/git-data/repositories/jasper/repo.git