Posts 在 vps 上 fork github 的 repo
Post
Cancel

在 vps 上 fork github 的 repo

~/.ssh/config 添加 vpsssh 配置

Host vps 
    Hostname <vps-ip-address>
    User <vps-user-name>
    Port <vps-port>
    IdentityFile <vps-rsa-file>

vpsfork github 的 repo

1
2
3
4
5
6
7
8
9
$ git clone --bare https://github.com/apache/arrow.git
Cloning into bare repository 'arrow.git'...
remote: Enumerating objects: 13, done.
remote: Counting objects: 100% (13/13), done.
remote: Compressing objects: 100% (10/10), done.
remote: Total 121519 (delta 3), reused 8 (delta 3), pack-reused 121506
Receiving objects: 100% (121519/121519), 67.04 MiB | 15.94 MiB/s, done.
Resolving deltas: 100% (84048/84048), done.

在本地 clone vpsrepo

1
2
3
4
5
$ git clone vps:~/arrow.git  
Cloning into 'arrow'...
remote: Counting objects: 121519, done.
remote: Compressing objects: 100% (30668/30668), done.
Receiving objects:  42% (51888/121519), 26.00 MiB | 11.00 KiB/s

使用 ssh clone vps 上的 repo 可能遇到 ssh: Could not resolve hostname 的问题

1
 git clone ssh://user@my.host:/path/to/repository

上述命令就会遇到这样的问题

1
2
3
Initialized empty Git repository in /current/path/repository/.git/
ssh: Could not resolve hostname my.host:: Name or service not known
fatal: The remote end hung up unexpectedly

解决方案1

1
git clone ssh://username@host.xz/absolute/path/to/repo.git/

解决方案2

1
git clone username@host.xz:relative/path/to/repo.git/

参考链接: https://kuttler.eu/en/post/git-clone-ssh-could-not-resolve-hostname/

This post is licensed under CC BY 4.0 by the author.