确定远程存储库的URL

时间:2017-09-17 15:25:57

标签: git

我已经向Web服务器提供了登录详细信息(通过SSH连接的用户名和密码)。 它包含一个Web应用程序,我应该通过git提交一些定期更新。 服务器通过其IP地址访问,我无法通过HTTP请求连接到它。 我在Web应用程序的根目录(public_html / app)中运行了git init命令。

我需要将其添加为远程存储库,但我不知道如何: 我尝试了以下方法:

git remote add APP user@209.32.x.x:public_html/app/app.git

然后

git clone user@209.32.x.x:public_html/app/app.git

但是我得到了

fatal: repository 'APP' does not exist

我是git的新手。

首先:我需要什么才能使app目录成为git repo?

第二:如何确定回购的链接是什么? (克隆什么?)

1 个答案:

答案 0 :(得分:2)

尝试使用文件夹的绝对路径:

 user@209.32.x.x:/path/to/public_html/app

如果您在git init内完成public_html/app,则无需添加“app.git”。
但如果您希望能够直接推送到非裸仓库,则需要添加git config receive.denycurrentbranch updateInstead

另一种方法是设置 bare repo (这将更符合您的app.git)文件夹,并推送到它(不需要接收配置) case),带有一个post-receive挂钩,然后检查最新推送到你网站的提交:

git --git-dir=/path/to/project_root/.git --work-tree=/path/to/public_html/app checkout -f

在这两种情况下,问题仍然存在:您是否拥有包含网站内容历史记录的git回购?