Use remote Git repository

When people develop collaborative projects local repository no longer applicable, and this time we need a remote repository, here we choose as our remote repository Github.

Using a local warehouse: https://www.cnblogs.com/jing-zhe/p/12178208.html

First, create a remote repository Github

  1. Register on the official website Github Github account  https://github.com/

  2. The following page after a successful login registration

  

 

 

   3. Select [Start a project to create a project to enter the following page]

  

  •   Repository name: warehouse Name
  •   The Description  (optional): Warehouse Description
  •   Public: public warehouse (free)
  •   Private: private warehouse (surcharge)
  •   Initialize this repository with a README: initialize the warehouse and create a README file

  4. Here we enter the warehouse name click [create] Create repository warehouse

  

 

 

   With this in our remote repository to create a complete, red box that we address on a remote repository.

Second, push the local repository to the remote warehouse

  Execute the following command to establish a connection between the local and remote warehouse Warehouse:

git remote add origin https://github.com/onlyLx/test.git
// remote repository of the address is the address you just created

  Then execute the following command will be pushed to the remote repository local repository (may verify Github account password)

git push -u origin master

 

  

 

 

   Push complete, warehouse refresh the page, you can see the contents of the local repository.

   In subsequent operations, if necessary push the local repository the command to execute a remote repository.

git push origin master

Third, the clone remote repository to your computer

  First, copy the address of the remote repository, execute the following command to clone

git clone https://github.com/onlyLx/test.git

四、解决冲突

  如果其他开发成员修改了某文件并推送至远程仓库,而自己也对该文件做出了相应修改时,推送就不会成功。

  

 

 

   这时候就需要执行 git pull 命令将远程仓库中的最新提交更新下来,手动修改冲突后重新提交

git add -u
git commit -m "说明"
git push origin master

 

git命令简易流程

Guess you like

Origin www.cnblogs.com/jing-zhe/p/12180348.html