user2543991
user2543991

Reputation: 625

Git directory vs SVN directory

In SVN, I can create a repository called

myserver/myprojects

then I can push a new project, called abcproject to the repository above. It becomes:

myserver/myprojects/abcproject

Is it similar for git? If I do:

cd abcproject
git init
git add .
git commit -m 'initial commit'
git remote add origin myname@myserver/myprojects
git push origin master

what will happen? Is my local abcproject stored in myprojects directory like with SVN, or do I have to create the local project called myprojects, the same name as the remote, and then push? Thanks for your help.

Upvotes: 1

Views: 47

Answers (1)

Borealid
Borealid

Reputation: 98459

Remote git pushes are between repositories.

You create a "bare" repository on the server. Then you clone that repository on the client. The clone creates a second repository - the client-side one.

Then you make commits on the client and push from the client repository to the server one.

Pushing never creates a new repository. It only sends changes from one that already exists to another one that already exists.

In the example you gave, you didn't run "git init" on the server, so you're going to get an error that there's no git repository at the path you specified on the remote end.

Upvotes: 1

Related Questions