Gitlab:导入我的旧gitlab存储库文件夹

时间:2018-01-15 21:34:37

标签: git docker gitlab

我在docker中设置了一个新的gitlab实例,但是我在导入旧的gitlab存储库文件夹时遇到了问题(我忘了备份数据库)。

我在gitlab问题板上发现我可以使用以下命令导入所有文件夹:

gitlab-rake gitlab:import:repos[/repositories]

但是当我尝试运行此操作时,我在我尝试导入的所有存储库中收到以下错误

Processing /repositories/Outboxit/YourMusic.git
 * Using namespace: Outboxit
 * Failed trying to create YourMusic (Outboxit/YourMusic)
   Errors: {:base=>["Unable to save project. Error: Permission denied @ dir_s_mkdir - /var/opt/gitlab/git-data/repositories/Outboxit"]}
Processing /repositories/Outboxit/MyBeer.git
 * Using namespace: Outboxit
 * Failed trying to create MyBeer (Outboxit/MyBeer)
   Errors: {:base=>["Unable to save project. Error: Permission denied @ dir_s_mkdir - /var/opt/gitlab/git-data/repositories/Outboxit"]}

sombody可能会帮助我解决这个问题,因为我真的需要把我的旧回购放回去,我正在努力工作3天没有尝试过。

1 个答案:

答案 0 :(得分:2)

我使用git而不是gitlab使用我编写的以下脚本修复它:

CURRENT_PROJECT="<project-name>"
CURRENT_GROUP="<group-name>"
git clone C:/Users/<user>/Desktop/repositories/$CURRENT_GROUP/$CURRENT_PROJECT.git $CURRENT_PROJECT
cd $CURRENT_PROJECT
git remote set-url origin http://<server-address>/$CURRENT_GROUP/$CURRENT_PROJECT.git

for branch in `git branch -a | grep remotes | grep -v HEAD | grep -v master `; do
   git branch --track ${branch#remotes/origin/} $branch
done

git push --all