gpt4 book ai didi

git - 在 Media Temple 服务器上克隆一个 git repo

转载 作者:太空狗 更新时间:2023-10-29 14:34:53 28 4
gpt4 key购买 nike

我有一个已经安装了 git 的 Media Temple 服务器。如何从我在 GitHub 上托管的存储库克隆文件?

最佳答案

这可能类似于在 Media Temple 服务器上克隆一个托管在 Unfundle 上的存储库(您有一个 comprehensive guide here) 的过程

Media Temple 部分涉及(假设您已经在本地计算机上创建了 SSH key 对并将其添加到 GitHub):

This is similar to the setting up the keys on your local machine except that the path to the .ssh folder is a bit different.
It will vary depending on the hosting plan you have with Media Temple. Mine was like this:

Instead of ~/.ssh, it was /home/HOSTING_CODE/users/.home/.ssh where HOSTING_CODE is the 5 digit number assigned to your hosting plan.

You'll know what the path is once you execute the "ssh-keygen -1 rsa" command. It will be mentioned at the filename prompt.

NOTE: Unlike on the local keygen, the remote server will require you to enter in the entire path from root.

SSH into your Media Temple server then proceed.

The following command will ask you for a filename and a password.

If you intend to have multiple key pairs (which you probably will at some point), then it's best to name them differently.

So provide a short descriptive filename each time you create a new key pair.
For unfuddle I use the SUBDOMAIN and "unfuddle", so for me it's "myproject_unfuddle". You'll be adding this to the .ssh/config file in a minute.

Also, while you CAN use an empty passphrase, you should always provide a password.

$ ssh-keygen -t rsa
Generating public/private rsa key pair.
$ Enter file in which to save the key (/home/HOSTING_CODE/users/.home/.ssh/id_rsa):
[provide a filename] <- create a short descriptive filename
[ie - myproject_unfuddle]

$ Enter passphrase (empty for no passphrase): [password] <- always use a password
$ Enter same passphrase again: [password confirmation]

$ Your identification has been saved in
/home/HOSTING_CODE/users/.home/.ssh/myproject_unfuddle.

$ Your public key has been saved in
/home/HOSTING_CODE/users/.home/.ssh/myproject_unfuddle.pub.
The key fingerprint is:
46:1b:99:56:77:0b:38:1e:35:92:de:94:58:b4:f3:d4 user@machine

The following will echo the public key to the screen. You'll need to copy this and paste it into unfuddle shortly.

$ cat /home/HOSTING_CODE/users/.home/.ssh/myproject_unfuddle.pub<
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAwIuZA6ca9I1E2c6j1lbqvzDpZD2XQ5dRGVjeby1SGX+6
tyjA1zcN9mim9DXOWiX1wyUwnQdNR3qmzJwjlX1riLpXoEutZxRHsvWyeQFsrWM8B5rJk0U0HDEEH+/9
u0SjGZZq0ERZE+L999ZzAYp7voxD7L7zFqp+odqNMpLln4A98JTBI50q5tVBQBbkh8wXHKPI0xLB1N9u7
VCLB8zrR7/SC73/t3XicnhmaaPL8R+9GKyfRtjxAWyRGZiG+A9ZDXgQ9m6kNP2xS3AFi2jRvHfH2tnmy
+KD80sn9hwqTIMANVr2FjVloBHmi+FIHeL9qFbdI/4DCJMHt/hEdAw== user@machine

Next we'll need to add this key to the ssh config file. If you've never created the config file then it probably doesn't exist yet.

So open/create the config file:

$ pico /home/HOSTING_CODE/users/.home/.ssh/config

Once inside add the new entry:

$ IdentityFile /home/HOSTING_CODE/users/.home/.ssh/myproject_unfuddle

As you add additional keys you'll need to add them to the config file. This file basically tells the keychain which keys to look in when comparing the private and public keys you've generated.

Simply add new entries above or below the others:

$ IdentityFile /home/HOSTING_CODE/users/.home/.ssh/myproject_unfuddle
IdentityFile /home/HOSTING_CODE/users/.home/.ssh/some_other_key_name

Then hit CTRL-X to quit, which will prompt you to save the buffer (hit y) and then a file name (defaults to the name you opened it with (config) then hit return)

SSH into your Media Temple server then proceed.

$ git clone gitRepoName@github.com:SUBDOMAIN/ABBREVIATION.git

You will be prompted for the password if the public key was found on GitHub.

关于git - 在 Media Temple 服务器上克隆一个 git repo,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2428910/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com