First, make sure that your git repository folder exists in the working directory.
$ pwd
/home/your_username/
$ ls
my_project/
...
Then, create a bare git repository from the existing repository
$ git clone --bare my_project my_project.git
You should now have the cloned bare repository
$ ls
my project/
my project.git/
...
Noe that .git ending is a conventional indication of server repository.
Next, copy the cloned repository to your server, usually through scp
$ scp -r my_project.git git_server_user@your.git.server:/git/
Here, you will need to replace git_server_user, your.git.server, and /git/ with the appropriate server username, server address, and destination path in the server, respectively.
That should be it. Now, to clone from your server, simply run the following from a client system
$ git clone ssh://git_server_user@your.git.server:/git/my_project.git
Of course, you may want to delete the bare repository from the local machine (not the server).
$ rm -rf my_project.git
That should do it!
No comments:
Post a Comment