Reputation: 13
So I started developing something locally and turned it into a git repo. Then I took the folder and ftp'd it onto a server. Now I have SSH access to the server and git is installed. I cd'd into the folder and git said there wasn't a repo there, which I thought was stored in /.git/ and would have been uploaded with it.
I'm basically looking to add this server as a remote to be able to push to but now I'm not sure if it's setup right. Would the correct way be to clone from local first? How do you do that?
Also git config --get remote.origin.url
isn't giving me anything on the server. I feel like I'm missing a big piece of the puzzle here.
Upvotes: 0
Views: 143
Reputation: 124648
The repo on the server should be a "bare" repository. Do it like this:
ssh
to the server and create a bare git repo:
git init --bare /path/to/repos/project.git
On your local PC, add a remote like this:
git remote add origin ssh://[email protected]/absolute/path/to/repos/project.git
And push to the remote for the first time:
git push -u origin master
Notes:
ssh://[email protected]/home/user/path/to/repos/project.git
.Upvotes: 1