Mr.DevEng
Mr.DevEng

Reputation: 2421

Git central repository for code management

I have an account in https://bitbucket.org for my project code management. I would like to choose my project belongs to git version control.I already worked with SVN version control. When I exploring the tutorial of creating a git repository I found that, creating a central repository and cloning the project into my local repository/local machine.

My doubt is that when I created my Bitbucket account, I got to home screen, and code commits options. This central repository location is owned by Bitbucket team. Actual space belongs to git teams. Can I create the same central repository in my personal On-Premise server? I need to create that central location within my remote machine instead of Bitbucket space.

I don't know my thinking direction is true or not. I need to know is this possible or not. How can I solve this space customization doubt?

Upvotes: 0

Views: 512

Answers (1)

apalomer
apalomer

Reputation: 1925

If you can access your remote machine remotely yes. This example is if you can have ssh with your remote, I do not know how to do it with http or any other protocol.

To do so, create a git repository in your remote host (get in your server using ssh and then create a git repository using git init --bare, note that most times if your local repo is called my_repoyour server one would be called my_repo.git). Then, in your local computer, create another repository. In the local repository you can add the remote origin either using http or ssh (I only have tested in my own remotes using ssh). To add your remote origini run:

git remote add origin user@remote_server:pat/to/remote/repository.git

then, you can git pull and push between the local and remote repository (note that first you need to push to origin with git push origin master).

Here you have a complete example on how to do it.

Upvotes: 2

Related Questions