Search This Blog

How to setup a remote git repository and push (or share) the local eclipse project to the repository

  1. Run the following commands on the server to host the central git repository:
    sudo apt-get install git
    mkdir /path/to/git-root/MyProject.git
    cd /path/to/git-root/MyProject.git
    git init --bare --shared=group
    
  2. Run the following commands on the local computer to push the local eclipse project to the repository:
    cd /path/to/workspace/MyProject
    git init
    echo "bin" > .gitignore
    git add '*'
    git add '.*'
    git commit -m "Initial commit"
    git remote add origin user@server.example.com:/path/to/git-root/MyProject.git
    git push -u origin master
    
  3. Now other team members can check out the project from the central repository:
    git clone user2@server.example.com:/path/to/git-root/MyProject.git
    cd MyProject
    

See Also:





No comments:

Post a Comment