On your machine
Install SSH: Make sure that openshh server is installed, otherwise other developer will not be able to pull code from your machine.sudo apt-get install openssh-server openssh-client
Create a new user: This is necessary if you don't want to share your password with others.sudo useradd -m USER_NAME
Example:sudo useradd -m guru
Setting the password for newly created user: Other developer will use this password to get your code.sudo passwd USER_NAME
Example:sudo passwd guru
Create a group: If you have created a new user, then this is necessary to create a group.sudo groupadd GROUP_NAME
Example:sudo groupadd developers
Add new user to this group: Add your own user and above created user to this new group. Why? wait.sudo usermod -G GROUP_NAME USER_NAME
Repeat above command to add your own user_name to this group. Example:sudo usermod -G developers guru
Change the ownership of repository directory: Now the new user and your own user will have rights to read the content of the repository, that's why we create a group.sudo chgrp GROUP_NAME REPO_DIR
Example:sudo chgrp developers ~/MyProject
On another machine
Add remote: Add a new remote location to your existing repository which was cloned from a common repository online e.g. githubgit remote add REMOTE_NAME ssh://
git remote add buddy ssh://guru@192.168.1.33/home/sumit/MyProject
To see the list of remotes: Verify new remote is successfully added.git remote -v
To see the list of branches on remotegit ls-remote --heads REMOTE_NAME
Example:git ls-remote --heads buddy
Pull remote branchgit pull REMOTE_NAME BRANCH_NAME
Example:git pull buddy new_feature
No comments:
Post a Comment