But in your organization, you need to have a place where you have your code resides either for keep code save, or even to do automated deployment or for any other reason.
suppose you have 2 Linux machines, machine A and machine B. (machine A will act like a server, where machine B will be your development machine)
1. machine A have to have ssh server installed; Login to machine A with user say 'git':
ssh git@machine_a
2. go to a directory where you want to keep your code, or even you want to do the autodeployemnt from there
sudo mkdir -p /repos/test-repo sudo chown -R git:git /repos/rest-repo
3. init the origin on the server
cd /repos/test-repo
git init --bare
4. Your server is ready now, Now go to the client machine and create a folder where you will put your development source code:
cd ~/my-test-repo-code
5. create local git repo and point to the remote server we just created
git init git remote add origin git@machine_a:/repos/test-repo
6. test your installation:
# we still in the client machine touch test-file.txt git add test-file.txt git commit -a -m 'init' git push remote origin
7. that's it, you now can write code and push it to your server, you can add hocks on the server (for deployment) or install your a web server to show the code in fancy interface or support other activities like code-review, etc.
Have fun.
No comments:
Post a Comment