在我的GoDaddy托管计划中设置一个git repo [英] Setting up a git repo on my GoDaddy hosting plan
问题描述
我有一个使用git进行版本控制的项目。
我想要做的就是在我的(启用ssh的) GoDaddy共享主机软件包,以便我可以通过推送进行部署,而不是通过FTP进行拖放。
任何提示都将不胜感激。最好是一个已经完成它的人的帐户,但我无法亲自找到任何在线。 工作,我能够让我的GoDaddy帐户上运行Git。在我的博客,但简短的答案是:
- 在您的帐户中安装git(也许使用我的博客文章中引用的tarball)
- 在您的账户中创建一个git存储库(裸露或不存储)
-
检查您的存储库,使用-u指示
git-upload-pack
%git clone -u libexec / git-core / git-upload-pack mysite:myrepo.git
b $ b
git-receive-pack
: %git config remote.origin.receivepack libexec / git-core / git-receive-pack
%git config remote.origin.uploadpack libexec / git-core / git-upload-pack
由于博客不再可访问,因此这里是完整的post pu从 archive.org :
在GoDaddy上使用Git
一个便宜的GoDaddy帐户。当最近通过SSH访问shell时,我认为安装本地git存储库会很有趣。这不是微不足道的,但我终于搞定了。以下是我做到的: 步骤0.配置SSH
您想创建一个公钥,可以无痛地SSH连接到您的GoDaddy帐户。如果您还没有密钥对,请创建一个密钥对,然后将它添加到〜/ .ssh / authorized_keys
中。我假定在〜/ .ssh / config
中输入如下内容:
Host mysite
HostName mygodaddysite.com
用户mylogin
步骤1.安装Git
在我的GoDaddy主机上找到后,我发现它运行的是CentOS 5.2。我的笔记本电脑上运行的二进制文件不兼容,所以我使用VirtualBox设置本地CentOS 5.2安装并构建Git。我正在分享一个包含预建的CentOS 5.2 Git二进制文件的tarball。您应该可以使用以下命令下载并安装:
$ b
wget http:// johntrammell。 com / centos5.2-git.tar.gz
tar xzf centos5.2-git.tar.gz
享受这一部分 - 我已经为您节省了几个小时的工作。
第2步。设置您的环境。将以下内容添加到.bash_profile中:
export EDITOR = vim
export PATH = $ PATH:$ HOME / bin:$ HOME / libexec / git-core
export LD_LIBRARY_PATH = $ HOME / lib $ b $ export GIT_EXEC_PATH =〜/ libexec / git-core
export GIT_TEMPLATE_DIR = 〜/ share / git-core / templates
这会在交互式shell上正确设置您的环境。不幸的是,我似乎无法让PATH正确设置非交互式SSH命令。例如,当我从我的笔记本电脑运行此命令时:
$ b
ssh mysite env
我看到了默认的PATH。当我在.bashrc中设置路径时,情况也是如此。我没有完全跟踪SSH在非交互式访问上的确切做法,但这可能与sshd中的PermitUserEnvironment设置有关。幸运的是我们可以解决这个问题。
第3步。创建存储库
登录到GoDaddy帐户,并创建一个简单的裸Git仓库:
$ b
%mkdir myrepo
%cd myrepo
%touch README
%git init
git add README
%git commit -m'git repository'
%cd ..
% git clone --bare myrepo myrepo.git
您现在拥有一个裸仓库〜/ myrepo.git /
。
第4步。检出您的存储库
唯一棘手的部分是你必须告诉git在哪里可以找到git-upload-pack。这适用于上面提到的PATH问题。在您的本地计算机上执行以下操作:
git clone -u libexec / git-core / git -upload-pack mysite:myrepo.git
您现在应该拥有原始最小版本库的副本
第5步。更多git配置调整
可悲的是我们没有完成:
%cd myrepo
%echofoo> README
%git commit -am'已更新'
[master 044c086]已更新
已更改1个文件,1次插入(+),0次删除( - )
%git push
bash:git-receive-pack:找不到命令
fatal:远端意外挂断
我们的PATH问题现在正在干扰推送操作。作为一种解决方法,我们可以在命令行中指定-receive-pack,或者在本地配置中设置它(同样适用于获取操作和-upload-pack):
%git config remote.origin.receivepack libexec / git-core / git-receive-pack
%git config remote.origin.uploadpack libexec / git-core / git-upload-pack
恭喜,您应该立即开始运行!
资源
- http://johntrammell.com/centos5.2-git.tar.gz
- https://serverfault.com/questions/26836/ git-repo-on-my-godaddy-hosting-plan /设置一个git回购在我的godaddy托管计划>设置一个git我的GoDaddy托管计划中的回购
- git-upload-pack:找不到命令,如何正确解决这个问题 http:// www .bluehostforum.com / showthread.php?20304-Bluehost-Solution-to-the-Git-PATH-when-using-a-non-interactive-shell
- http://www.google.com/search?q=ssh+setup
- http://www.kernel.org/pub/software/scm/git/docs/git-upload-pack.html
- http://www.kernel。 org / pub / software / scm / git / docs / git-receive-pack.html
I have a project which is version-controlled using git.
What I want to be able to do is set up a repo on my (ssh-enabled) GoDaddy shared hosting package so that I can deploy with a push rather than dragging and dropping in FTP.
Any tips would be appreciated. Best would be an account from someone who's already done it, but I couldn't personally find any online.
With a little work, I was able to get Git running on my GoDaddy account. There's a longer posting detailing the process on my blog, but the short answer is:
- install git in your account (perhaps using the tarball referenced in my blog post)
- create a git repository (bare or not) in your account
check out your repository, using -u to indicate the path to
git-upload-pack
% git clone -u libexec/git-core/git-upload-pack mysite:myrepo.git
tweak your local repository config to point to the correct paths to
git-upload-pack
andgit-receive-pack
:% git config remote.origin.receivepack libexec/git-core/git-receive-pack
% git config remote.origin.uploadpack libexec/git-core/git-upload-pack
Since the blog is no longer accessible, here is the full post pulled from archive.org:
Using Git on GoDaddy
This blog is hosted on a cheap GoDaddy account. When shell access over SSH was recently made available, I thought it would be fun to install local git repositories. It wasn’t trivial, but I did finally get it working. Here’s how I did it:
Step 0. Configure SSH
You want to create a public key so you can SSH in to your GoDaddy account painlessly. Create a key pair if you don’t already have one, and add it to ~/.ssh/authorized_keys
. I’ll assume an entry in ~/.ssh/config
something like this:
Host mysite
HostName mygodaddysite.com
User mylogin
Step 1. Install Git
After poking around on my GoDaddy host, I discovered it was running CentOS 5.2. Binaries running on my laptop weren’t compatible, so I used VirtualBox to set up a local Centos 5.2 install and build Git. I’m sharing a tarball containing the pre-built CentOS 5.2 Git binaries. You should be able to download and install with the commands:
wget http://johntrammell.com/centos5.2-git.tar.gz
tar xzf centos5.2-git.tar.gz
Enjoy this part–I’ve saved you a couple hours’ work here.
Step 2. Set up your environment.
Add the following to your .bash_profile:
export EDITOR=vim
export PATH=$PATH:$HOME/bin:$HOME/libexec/git-core
export LD_LIBRARY_PATH=$HOME/lib
export GIT_EXEC_PATH=~/libexec/git-core
export GIT_TEMPLATE_DIR=~/share/git-core/templates
This will set your environment up correctly on an interactive shell. Unfortunately I can’t seem to get the PATH to set correctly for non-interactive SSH commands. For example, when I run this command from my laptop:
ssh mysite env
I see the default PATH. This is also the case when I set the path in .bashrc. I haven’t tracked down exactly what SSH does on non-interactive access, but this may be related to the PermitUserEnvironment setting in sshd. Luckily we can work around this.
Step 3. Creating a repository
Log in to your GoDaddy account, and create a simple "bare" Git repository:
% mkdir myrepo
% cd myrepo
% touch README
% git init
% git add README
% git commit -m 'empty git repository'
% cd ..
% git clone --bare myrepo myrepo.git
You now have a bare repository in ~/myrepo.git/
in the root of your GoDaddy account.
Step 4. Checking out your repository
The only tricky part to this is that you have to tell git where to find git-upload-pack. This works around the PATH problem mentioned above. On your local machine, do this:
git clone -u libexec/git-core/git-upload-pack mysite:myrepo.git
You should now have a copy of the original minimal repository checked out.
Step 5. More git configuration tweaks
Sadly we are not done:
% cd myrepo
% echo "foo" > README
% git commit -am 'updated'
[master 044c086] updated
1 files changed, 1 insertions(+), 0 deletions(-)
% git push
bash: git-receive-pack: command not found
fatal: The remote end hung up unexpectedly
Our PATH problems are interfering with the push operation now. As a workaround, we can either specify –receive-pack on the command line, or set it in the local configuration (the same applies for fetch operations and –upload-pack):
% git config remote.origin.receivepack libexec/git-core/git-receive-pack
% git config remote.origin.uploadpack libexec/git-core/git-upload-pack
Congratulations, you should be up and running now!
Resources
- http://johntrammell.com/centos5.2-git.tar.gz
- https://serverfault.com/questions/26836/setting-up-a-git-repo-on-my-godaddy-hosting-plan
- Setting up a git repo on my GoDaddy hosting plan
- git-upload-pack: command not found, how to fix this correctly
- http://www.bluehostforum.com/showthread.php?20304-Bluehost-Solution-to-the-Git-PATH-issue-when-using-a-non-interactive-shell
- http://www.google.com/search?q=ssh+setup
- http://www.kernel.org/pub/software/scm/git/docs/git-upload-pack.html
- http://www.kernel.org/pub/software/scm/git/docs/git-receive-pack.html
这篇关于在我的GoDaddy托管计划中设置一个git repo的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!