Monday, November 14, 2011

Set up a Custom Git Remote Server like GitHub



In the server:
# have ssh installed on your server
$ sudo apt-get install openssh-server

# install git on both local and server machine
sudo apt-get install git

# navigate inside the folder you want to contain the repository
# create a new repository
$ git init

In local machine:
# navigate inside the folder you want to contain the repository
# create a new repository
$ git init

# set the origin
$ git remote add origin ssh://michael@192.168.0.175/GitServerFolderCreatedLocation

# update the server
# when pushing to the server make sure your not in the branch your pushing to
# you may need to fetch and merge (pull) before you can push
$ git push origin --all          #or $ git push origin [branch Name]

# update the local machine, get data from server
$ git fetch origin [branch Name]

No comments:

Post a Comment