【问题标题】:How to properly set up local and remote git repos如何正确设置本地和远程 git repos
【发布时间】:2014-07-14 22:22:29
【问题描述】:

我有一个本地 git repo 的本地 rails 应用程序。我想将它推送到我的远程网络服务器,然后能够将更改的文件推送到那里。

我尝试通过 SCP 传输所有文件,然后在本地运行 git clone ssh://...,但是当我尝试将文件从本地推送到远程时,我收到 [remote rejected] master -> master (branch is currently checked out) 错误。

围绕此错误的所有堆栈问题都不适用于我(即我可以推送,但远程服务器上实际上没有文件显示,或者我仍然收到错误)。

我如何设置它以便我可以

a) 将文件从本地推送到远程

b) 有一个完整的副本可以从远程运行 rails 服务器?

编辑:克隆的 repo .git/config

[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
[remote "origin"]
        url = ssh://10.1.150.24:/home/mwerner/dashing/.git
        fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
        remote = origin
        merge = refs/heads/master

【问题讨论】:

标签: ruby-on-rails git ssh


【解决方案1】:

对于 ssh 访问:

git clone git+ssh://remote_pc/path_to_folder

对于 git-server 的 gaccess:

git clone user@server:path/to/git/repo

github:

git clone git@github.com:user/repo

【讨论】:

  • 前两个仍然给我关于非裸存储库的错误,第三个不适用,因为我没有使用github
  • @Killerpixler 也尝试指定--bare my_project
猜你喜欢
  • 1970-01-01
  • 2021-01-25
  • 2014-05-11
  • 2013-07-22
  • 2017-01-04
  • 1970-01-01
  • 2011-05-13
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多