Git repository creation: Remote initialize repository, local clone remote library, local get commit new content

Source: Internet
Author: User
Tags commit git clone
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.