2

On a server that I'm working, I find that I have Git support. Tired by going with PuTTY to do each commit, I'll like to clone that repository to my machine and push back only when I've done my local work.

how can I find the name of that git repository? On that Linux server I'm a user which has access with FTP and SSH. My web application is public available on the address http://linux_server_IP_address/~linux_user.

4
  • "I'll like to clone that repository" - if you don't know what "that" repository is called, how is any one else supposed to know? Commented Aug 29, 2011 at 7:24
  • how can I find the name of the repository? Commented Aug 29, 2011 at 7:26
  • What repository? How, in practice, are you identifying the repository that you are talking about? Commented Aug 29, 2011 at 7:30
  • exactly this is the title of my question Commented Aug 29, 2011 at 7:54

3 Answers 3

3

The name of the repository is the folder name of the parent folder which contains the repository (since you do your work on that server, it's the folder, which contains the .git folder). But if there's a .git folder, it's not a bare repository, and then push to that repository is very bad practice. You should create a bare repository, and then clone that repository and push to it.

Sign up to request clarification or add additional context in comments.

2 Comments

In my project folder, I have a .git folder. Can I push to that repository?
You can, but you shouldn't, because you would overwrite local work, that you would have done in the working directory on the server.
1

You want to know the path to your repository, not the name.

Assuming that your repository is stored under $HOME/myrepo, you could clone it that way:

git clone http://linux_server_ip/~linux_user/myrepo 

But cloning via HTTP, you cannot push back changes to the server, so better use the SSH protocol:

git clone ssh://linux_user@linux_server_ip/myrepo 

See the man page of git clone for more information about the different protocols.

Note that you won't be able to push directly to myrepo since it's not a bare repository. To push to master on myrepo, master must not be checked out on myrepo. To achieve this, go to myrepo, create a temporary branch (git checkout -b nocommit), then git push origin master:master and then git checkout master again.

The topic of pushing into a non-bare repository has been discussed several times here:

1 Comment

If there's a properly set up HTTP server, then pushing is also possible with HTTP. But i doubt, there is. You should also mention, that for SSH the username is needed.
0

What people here fail to appreciate is that you are just typing

git <command> 

and you never see a hostname.

You have to find your .git directory (it may be in a directory further up in your path), cd there and then check the config file, the whole URL you need will be there.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.