How do I clone and push to a bare git repo I copied over

Avatar
  • Answered
Hi,

I was wondering if anyone can help me with setting up a git repo on my shared hosting which I can use similarly to a repo hosted on github. I am following: http://git-scm.com/book/en/v2/Git-on-the-Server-Getting-Git-on-a-Server and have cloned a bare repo from the one I'm working on locally. I managed to get this on the server via scp.

Now, I am trying to clone this repo but not managing. I have tried (username/servername used in scp command):

1) git clone username@servername:/path/to/bare/repo
1) result: hangs
2) a) adding to ~/ssh/config:
HostName servername
IdentityFile ~/.ssh/in_motion

where ~/.ssh/in_motion is the identity file I use with scp -i.
2) b) git clone username@servername:/path/to/bare/repo
2) result: hangs

3) a) Create file gitssh.sh with execute permissions:
#!/bin/bash
/usr/bin/ssh -i ~/.ssh/in_motion "$@"
3) b) export GIT_SSH=/path/to/gitssh.sh
3) c) git clone username@servername:/path/to/bare/repo
3) result: hangs

4) a) Adding the port which I used when secure copying with scp i.e. scp -P 2222, to the gitssh.sh:
/usr/bin/ssh -i ~/.ssh/in_motion -P 2222 "$@"
4) b) with GIT_SSH set:
git clone [email protected]:/home/userna5/mygitrepos/mysite.git
4) result -> Cloning into 'barereponame'...
ssh: connect to host 2222 port 22: No route to host
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

I seem to be using all the data I used as input for scp which successfully uploaded the bare repo on the server...

Is this even possible?

Regards,
Justin
Avatar
JeffMa
Your best solution may be to push your code to a private repo on GitHub, then simply run a Git Pull on your live location to implement those changes to your local branch.
Avatar
Scott
Hello Justin, Unfortunately, we do not allow git-clone repos on our servers as they are a violation of our Terms of Service. Kindest Regards, Scott M