deviloper
deviloper

Reputation: 7240

Determine the URL of a remote repository

I have been provided the login details (username and password to connect through SSH) to a web server. It contains a web application that I am supposed to submit some regular updates via git. The server is access via its IP address and I can't connect to it via HTTP requests. I ran the git init command inside the root directory (public_html/app) of the web application.

I need to add it as a remote repository but I do not know how: I tried the following:

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

and then

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

But I get

fatal: repository 'APP' does not exist

I am new to git.

first: What do I need to make the app directory a git repo?

second: how to determine what the link of the repo is? (What to clone?)

Upvotes: 1

Views: 87

Answers (1)

VonC
VonC

Reputation: 1327194

Try to use the absolute path for the folder:

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

If you have done a git init within public_html/app, you don't need to add an "app.git".
But you do need to add git config receive.denycurrentbranch updateInstead if you want to be able to push directly to a non-bare repo.

Another approach is to set up a bare repo (which would be more in line with your app.git) folder, and push to it (no receive config needed in that case), with a post-receive hook which will then checkout the latest pushed commit to your site:

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

In both case, the question remains: do you have a git repo with the site content history?

Upvotes: 2

Related Questions