(记录)Git仓库完整迁移

切换到git账户

jack@jack:/mnt/rock64pro/rockpro64.git$ su git

初始化仓库名

git@jack:/mnt/rock64pro/rockpro64.git$ git init --bare rockpro64.git
初始化空的 Git 仓库于 /mnt/rock64pro/rockpro64.git/rockpro64.git/

切换到代码目录,推送本地代码到新建的仓库

jack@jack:/mnt/rock64pro/rockpro64_3399v7.1/kernel$ git push --mirror git@jack:/mnt/rock64pro/rockpro64.git/rockpro64.git
The authenticity of host 'jack (127.0.1.1)' can't be established.
ECDSA key fingerprint is 94:89:64:8f:ac:35:59:48:7d:25:60:10:40:41:ab:ec.
Are you sure you want to continue connecting (yes/no)? y
Please type 'yes' or 'no': yes
Warning: Permanently added 'jack' (ECDSA) to the list of known hosts.
git@jack's password: 
Counting objects: 4793698, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (762994/762994), done.
Writing objects: 100% (4793698/4793698), 930.21 MiB | 23.58 MiB/s, done.
Total 4793698 (delta 3996884), reused 4793259 (delta 3996583)
To git@jack:/mnt/rock64pro/rockpro64.git/rockpro64.git
 * [new branch]      master -> master
 * [new branch]      pinebook -> pinebook
 * [new branch]      rockpro64 -> rockpro64
 * [new branch]      m/master -> m/master
 * [new branch]      rk/stable -> rk/stable
jack@jack:/mnt/rock64pro/rockpro64_3399v7.1/kernel$ 

修改git路径为新路径:

jack@jack:/mnt/rock64pro/rockpro64_3399v7.1/kernel$ vim .git/config 

[core]
        repositoryformatversion = 0
        filemode = true
[filter "lfs"]
        smudge = git-lfs smudge --skip -- %f
[remote "rk"]
        url = git@jack:/mnt/rock64pro/rockpro64.git/rockpro64.git
        projectname = rk/kernel
        fetch = +refs/heads/*:refs/remotes/rk/*
[branch "master"]
        remote = rk
        merge = refs/heads/stable
[branch "rockpro64"]
        remote = rk
        merge = refs/heads/stable

测试可以正常连接

jack@jack:/mnt/rock64pro/rockpro64_3399v7.1/kernel$ git pull git@jack:/mnt/rock64pro/rockpro64.git/rockpro64.git
git@jack's password: 
来自 jack:/mnt/rock64pro/rockpro64.git/rockpro64
 * branch            HEAD       -> FETCH_HEAD
Already up-to-date.

推送一个自己的更改记录,可以看到自己的记录和原先的都在:

jack@jack:/mnt/rock64pro/rockpro64_3399v7.1/kernel$ git add arch/arm64/boot/dts/rockchip/rk3399-mid-808-android_sdboot_edp.dts
jack@jack:/mnt/rock64pro/rockpro64_3399v7.1/kernel$ git commit -m "add sdboot-NT156FHM-edp,gt9xx-dts"
[rockpro64 2a6d40f] add sdboot-NT156FHM-edp,gt9xx-dts
 1 file changed, 1287 insertions(+)
 create mode 100755 arch/arm64/boot/dts/rockchip/rk3399-mid-808-android_sdboot_edp.dts
jack@jack:/mnt/rock64pro/rockpro64_3399v7.1/kernel$ git log
commit 2a6d40fa69d621f5f822ec4ddbbce01cad563562
Author: jack <5480922+chenzhecvc@user.noreply.gitee.com>
Date:   Sun Jul 19 19:56:00 2020 +0800

    add sdboot-NT156FHM-edp,gt9xx-dts

commit 6f8cd9785c1dcc024500591a20bff86f4153dbef
Author: tug <tugy@skyth-tek.com>
Date:   Wed Apr 17 14:02:22 2019 +0800

    add ap6256 support