The Prenx
The Prenx

Reputation: 672

Setup Git repo as server (origin) and get its url

I want to setup a git repo which will be cloned by others. This server is, say, gitserver.com.

So in my project directory of gitserver.com ~/nodejs/project I did git init, git add and git commit.

Now to clone this on a different machine, I tried the following: -

git clone ssh://[email protected]/nodejs/project
git clone ssh://[email protected]/nodejs/project.git
git clone git://[email protected]/nodejs/project
git clone git://[email protected]/nodejs/project.git

But I get this error -

Cloning into 'project'... fatal: '/nodejs/project.git' does not appear to be a git repository fatal: Could not read from remote repository.

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

So am I missing any step? How do I get the url of the repo created in gitserver.com?

Upvotes: 1

Views: 116

Answers (1)

user4046031
user4046031

Reputation:

There is a difference between local and remote git repos. Remote in a sence that it's central repository, origin.

In ~remote/project directory

git init --bare

Go to your local directory

git remote add origin ~/remote/project

git commit -a -m "Initial commit"

git push -u origin master

Upvotes: 1

Related Questions