我在开发服务器上有一个git clone / repo,但现在我正在转向另一个。我不想提交所有本地分支机构和主存储库的更改,那么如何才能将旧服务器上的所有内容复制到新服务器?
我试过 oldserver:〜$ scp -rp project newserver:〜/ project
但是我只需要加载和加载尝试在newserver上执行任何操作时出现typechange错误。
有人对x模式进行了说明,但是如何在服务器之间移动文件时保留该模式?
解决方案如果您想要一个git解决方案,您可以尝试
git clone --mirror< oldurl> < NEWURL>虽然这只适用于裸仓库。
如果这是一个非裸回购,你也可以做正常的克隆,接下来是这样的:
git获取原点 git branch -r | grep'^ * origin / [^] * $'| 读取rb;做的git分支 - 无轨道$ {rb#* /} $ rb;完成 git remote rm origin中间步骤当然可以用5000种不同的方式完成,但那是一个! (请注意,在bash中的管道之后不需要延续线\ - 它知道它需要更多输入)
最后,我建议使用rsync代替如果你想直接复制scp(可能带有-avz选项?)。 (这些typechange错误到底是什么?)
I have a git clone/repo on a development server, but I am now moving to another one. I don't want to commit all my local branches and changes to the main repository, so how can I make an exact copy of everything on oldserver to newserver?
I tried oldserver:~$ scp -rp project newserver:~/project
but then I just get loads and loads of "typechange" errors when trying to do anything on newserver.
Someone said something about x-modes, but how can I preserve that when moving files between servers?
解决方案If you want a git solution, you could try
git clone --mirror <oldurl> <newurl>though this is only for bare repositories.
If this is a non-bare repo, you could also do the normal clone, followed by something like this:
git fetch origin git branch -r | grep '^ *origin/[^ ]*$' | while read rb; do git branch --no-track ${rb#*/} $rb; done git remote rm originThe middle step can of course be done in 5000 different ways, but that's one! (note that the continuation line \ isn't necessary after the pipe in bash - it knows it needs more input)
Finally, I'd suggest using rsync instead of scp (probably with -avz options?) if you want to directly copy. (What exactly are these typechange errors?)
更多推荐
将一个git仓库移到另一台服务器上
发布评论