First, the premiseInstall Git:yum installed git on the virtual machine, no virtual machine can see Windows install Linux virtual machine (CENTOS7) virtual machine address: 192.168.240.139 Create a git directory under the native D drive. and new Git1 and git2 two directories git1 and Git2 are used to clone the remote warehouse, and then the simulation team two people collaborate, one party submits the file, the other party updates the file
second, remote initialization of the warehouse
Initialize the repository on the virtual machine: Create a new git directory under/usr/local to enter the git directory, enter git init–bare for initialization (–bare is recommended, otherwise it will affect file submission) as shown below.
third, local clone remote library
Locally in the git1 and Git2 directory using the following command to clone the library, after successful, you will find that our directory will have a git project, cut the project has a. Git directory:
git clone root@192.168.240.139:/usr/local/git
Git2 directory also clone a copy of the clone command root and the password that you need to enter is the path to your virtual machine's account password after the colon/usr/local/git is the path you get when you init the directory pwd
Iv. Local access to submit new content
add a file to the GIT project in git1 a.txt
#将新增或有改动的所有文件加入到缓存区
git add--all.
#将add的所有文件提交到本地git库
git commit-m "add a.txt"
#推送本地git库的更新到远程仓库
git push Origin master
get updates for git projects in Git2
#从远程库拉取最新内容
git pull Origin Master
Successful pull, and vice versa in the Git2, in the git1 can also be pulled to.