如何使用SCM备份还原BitBucket备份



我最近尝试使用SCM备份来备份我的Bitbucket存储库。这是我所做的:

在我的MacOS上安装了点网

安装了SCM备份

我在bitbucket中创建了用于SCM备份的应用程序密码。

我在设置中进行了以下更改。yml文件:

# all backups go here
localFolder: 'c:scm-backup'
# when an error occurs, wait that many seconds before exiting the application
waitSecondsOnError: 5
# uncomment this to send SCM Backup's console output via email
#email:
#  from: from@example.com
#  to: to@example.com
#  server: smtp.example.com
#  port: 0
#  useSsl: false
#  userName: testuser
#  password: not-the-real-password
sources:
  - title:  bitbucket_bkp
    hoster: bitbucket
    type: org
    name: my_username
    authName: my_username
    password: App Password that I created

现在我运行时 -

dotnet ScmBackup.dll

它给出输出 -

SCM Backup 1.2.1.552abf5
https://scm-backup.org/
Backing up config files
Getting repositories for source 'bitbucket_bkp' from hoster 'bitbucket'
Trying to find SCMs on this machine...
Backing up source: bitbucket_bkp
Backup finished!
The backups are in this directory: c:scm-backup

如何从此C: scm-backup文件恢复存储库?

我对此一无所知。

也按照文档Bitbucket-scm-backup的规定在"设置"字段中的名称字段中给出以下错误时:

SCM Backup 1.2.1.552abf5
https://scm-backup.org/
Backing up config files
Getting repositories for source 'bitbucket_bkp' from hoster 'bitbucket'
User my_team_name not found!
Backup failed!
The application will close in 5 seconds!

我想在Bitbucket中备份我团队的所有存储库并恢复它?

我该怎么办?

根据克里斯的建议,我在设置中进行了以下更改。yml文件 -

# all backups go here
localFolder: '/Users/rahman/Desktop/'

现在,当我进行备份时,我在桌面中获取了一个名为 bitbucket_bkp 的文件夹。但是它是空的。我该如何还原?

另外,我如何通过指定团队名称来对整个团队进行备份?它对我不起作用。

要备份我的团队,我已经对设置文件进行了更改 -

# all backups go here
localFolder: '/Users/rahman/Desktop/riz_bkp/'
# when an error occurs, wait that many seconds before exiting the application
waitSecondsOnError: 5
# uncomment this to send SCM Backup's console output via email
#email:
#  from: from@example.com
#  to: to@example.com
#  server: smtp.example.com
#  port: 0
#  useSsl: false
#  userName: testuser
#  password: not-the-real-password
sources:
  - title:  bitbucket_bkp
    hoster: bitbucket
    type: org
    name: team_name

现在我得到了错误 -

SCM Backup 1.2.1.552abf5
https://scm-backup.org/
bitbucket_bkp: AuthName and Password are empty. Without authentication, SCM Backup will backup public repositories only!
Backing up config files
Getting repositories for source 'bitbucket_bkp' from hoster 'bitbucket'
User team_name not found!
Backup failed!
The application will close in 5 seconds!

该怎么办?

问题1:"如何从此C: scm-backup文件中还原存储库?"

很高兴听到SCM备份在MacOS上起作用,但请在系统要求中注意:

到目前为止,SCM备份仅在Windows上编写和测试。从技术上讲,它也应该在Linux和MacOS上运行,但尚未进行测试。

我在Windows上,c:scm-backup是Windows上有效的文件夹/目录,但可能无法在Mac上使用。
(c:是Windows上的系统驱动器(

我无法访问Mac,所以我无法测试任何内容...但是根据我刚刚搜索的内容,您应该使用/Users/your_user/Documents/scm-backup这样的路径。

路径应该已经存在,并且正在运行SCM备份的用户应具有对其的写入访问。
如果您可以确认这有效,我将其添加到文档中。

关于还原:

您可能会阅读有关还原的文档。在那里描述了如何进行实际还原的技术步骤,但是现在缺少的是描述本地文件夹的内容。

我会将其添加到文档中,但这是简短的版本:

localFolderc:scm-backup更改为MACOS上的任何作品之后,运行SCM备份和文件夹应包含一个配置中定义的每个源的一个子文件夹。因此,在您的情况下,应命名为bitbucket_bkp

在内部,每个存储库都有一个子文件库, 内部至少有一个子文件夹repo(也许另一个名为wiki,如果该仓库具有Wiki(。

(。

repo文件夹中包含来自Bitbucket的存储库的完整克隆,这是有关还原文档的"本地存储库"。


问题2:备份时,当您尝试备份团队

时,备份会出现错误

请参阅有关配置中资源的文档:

每个源必须至少具有这四个属性:

[...]

type

userorg,具体取决于您是否要备份用户或组织。

name

您要备份的用户/组织的名称。

所以要么是:

type: user
name: my_username

或:

type: org
name: my_team_name 

在您发布的示例配置中,它是两者的混合物。

scm-backup和docker桌面上的macos上使用苹果硅

2023 Update: 
scm-backup: 1.7.0
Docker: Docker Desktop 4.21.1
MacOS: 13.4.1
Apple Silicon: M1 Pro

(我使用Juris的评论:https://github.com/christianspecht/scm-backup/issues/49#issuecomment-830032953并更新了版本(

Dockerfile

内容:

FROM alpine:3.18
ARG SCM_FILE=scm-backup-1.7.0.6090ea9.zip
ARG DOTNET_FILE=dotnet-runtime-3.1.14-linux-musl-x64.tar.gz
ARG DOTNET_FILE_SHA512=77856f6183ef7ee561fe8510e89148566972ae21e3915242ae4ac7ef987b1aa78cda09bb06fdae96cd03758975dc5eb0e8652dea79b96db327ac5de2a4d41961
ENV SCM_ROOT=/opt/scm-backup
ENV DOTNET_ROOT=/opt/dotnet
ENV PATH=${PATH}:${DOTNET_ROOT}
WORKDIR ${SCM_ROOT}
RUN apk add --no-cache 
        bash icu-libs krb5-libs 
        libgcc libintl libssl1.1 
        libstdc++ zlib curl git 
 # Install dotnet runtime
 && curl -fsL -o ${DOTNET_FILE} https://download.visualstudio.microsoft.com/download/pr/e7f88aae-a10e-4b49-8ccd-31f2df82cf3f/35fb27716a3b7543ef2889f0e4c19949/${DOTNET_FILE} 
 && echo "${DOTNET_FILE_SHA512}  ${DOTNET_FILE}" > ${DOTNET_FILE}.sha512 
 && sha512sum -c ${DOTNET_FILE}.sha512 
 && mkdir -p ${DOTNET_ROOT} 
 && tar zxf ${DOTNET_FILE} -C ${DOTNET_ROOT} 
 # Install scm-backup
 && curl -fsL -o ${SCM_FILE} https://github.com/christianspecht/scm-backup/releases/download/1.7.0/${SCM_FILE} 
 && unzip ${SCM_FILE} 
 && rm -f ${SCM_FILE} ${DOTNET_FILE} ${DOTNET_FILE}.sha512 
COPY settings.yml .
ENTRYPOINT dotnet ScmBackup.dll

settings.yml

内容:

localFolder: '/scm-backup-out'
sources:
  - title: git_backup_from_bitbucket
    hoster: bitbucket
    type: org
    name: team_or_workspace_name_here
    authName: username_here_not_email_address
    password: app_password_here

文件夹结构:

bitbucket-backups (folder)
Dockerfile
settings.yml

用法:

docker pull alpine:3.18
docker build --progress plain --platform linux/x86_64 -t scm-backup .
docker run -v ${PWD}:/opt/scm-backup/backup --mount src=`pwd`/bitbucket-backups,target=/scm-backup-out,type=bind scm-backup

最新更新