Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails Rails/Git:can';t将我的rails代码推出到服务器(';~/git/myapp.git';似乎不是git存储库)_Ruby On Rails_Linux_Git_Ruby On Rails 3.1 - Fatal编程技术网

Ruby on rails Rails/Git:can';t将我的rails代码推出到服务器(';~/git/myapp.git';似乎不是git存储库)

Ruby on rails Rails/Git:can';t将我的rails代码推出到服务器(';~/git/myapp.git';似乎不是git存储库),ruby-on-rails,linux,git,ruby-on-rails-3.1,Ruby On Rails,Linux,Git,Ruby On Rails 3.1,我是rails和git的新手。我在..../myapp下有一个rails应用程序,我想使用capistrano进行部署。我遵循了“使用Rails进行敏捷Web开发”中描述的步骤。为了将应用程序置于版本控制之下,我执行了以下操作: 1) 将我的应用程序置于版本控制下: $ cd myapp $ git init $ git add . $ git commit "..." 一切顺利,它在myapp下创建了一个.git目录/ 2) 在服务器上创建了一个空存储库: $ mkdir -p ~/git/

我是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
值得注意的是,这一切都发生在同一台服务器上,RHEL5.7。这让我很困惑,因为我基本上是用ssh从我的服务器连接到我的服务器上。但显然capistrano就是这样做的,即使应用程序开发和svn存储库在同一台物理机器上

@马诺兹:

$ 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/)

中。在添加origin时,使用相对路径并指定ssh部分可能会导致其中断

尝试与此更接近的方法:

git远程添加源user@myserver.com:/var/git/myapp.git


不,波浪线只是表示它是根目录。这正是git目录所在的地方。@user1090153您知道tilde不是实际的根目录,对吗?这是你的主目录。。“root”目录是
/
:PWell,我创建了作为root的存储库。反馈是:$Initialized empty Git repository in/root/Git/myapp.Git/如果我使用Git remote add originme@host:/root/git/myapp.git这是完全相同的行为。Tilde扩展不是跟踪路径中没有看到的问题,它会导致完全相同的行为。您可以执行
git\u trace=2 git推送原始主控形状
并粘贴你的问题是什么?@manoj;ds:看我更新的问题,你能试着克隆回购协议吗?然后也可能是从克隆人身上推出来的。不确定我是否理解你的意思。克隆空存储库?像git clone~/git/myapp.git/告诉我克隆到myapp。。。完成。警告:您似乎克隆了一个空存储库。但我现在应该推哪一个?克隆的一个到哪里去了?使用git clonessh://me@主机/~/git/myapp.git.
。现在尝试在此处添加文件并提交,然后执行git push origin master