[英]Rails/Git: can't push my rails code out to the server ('~/git/myapp.git' does not appear to be a git repository)
我是Rails和git的新手。 我在.... / myapp下有一个Rails应用程序,我想使用capistrano进行部署。 我遵循了“使用Rails进行敏捷Web开发”中描述的步骤。 为了将应用程序置于版本控制下,我执行了以下操作:
1)将我的应用程序置于版本控制下:
$ cd myapp
$ git init
$ git add .
$ git commit "..."
一切顺利,它在myapp /下创建了一个.git目录
2)在服务器上创建一个空的存储库:
$ mkdir -p ~/git/myapp.git
$ cd ~/git/myapp.git
$ git --bare init
$ Initialized empty Git repository in /root/git/myapp.git/
3)创建一个公钥
$ ssh-keygen -t rsa -C "myemail@myemail.com"
$ Your identification has been saved in /root/.ssh/id_rsa.
$ Your public key has been saved in /root/.ssh/id_rsa.pub.
$ The key fingerprint is:
$ d2:16:76:e0:4c:71:de:de:4b:d3:16:94:cc:d7:65:11 myemail@myemail.com
$ cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
4)在我的应用程序目录中:创建服务器的路径并推送代码
$ git remote add origin ssh://me@host/~/git/myapp.git
$ git push origin master
在此之后,现在要求我输入密码:
$ fatal: '~/git/myapp.git' does not appear to be a git repository
$ fatal: The remote end hung up unexpectedly
可能值得注意的是,所有这些操作都在同一服务器RHEL 5.7上发生。 这让我感到困惑,因为我基本上是从服务器SSH到服务器。 但这显然是capistrano的工作方式,即使application_development和svn存储库位于同一台物理计算机上也是如此。
// @ manojlds:
$ GIT_TRACE=2 git push origin master
$ trace: built-in: git 'push' 'origin' 'master'
trace: run_command: 'ssh' 'me@host' 'git-receive-pack '\''/root/git/myapp.git'\'''
可以肯定的是,您不希望波浪号〜出现在路径中。 我将实际路径放入(例如/ home / users /)
添加原点时,使用相对路径并指定ssh部分可能导致其断开。
尝试更接近于此的方法:
git remote add origin user@myserver.com:/var/git/myapp.git
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.