git的相关操作(Git related operations)

 代码关联Git远程仓库

在远程仓库上创建一个新项目 (通过gitee)

将本地项目关联到远程仓库

# 在当前目录新建一个Git代码库$ git init# 添加当前目录的所有文件到暂存区$ git add .# 提交暂存区到仓库区$ git commit -m [message]# 增加一个新的远程仓库,并命名$ git remote add [shortname] [url(SSH)]# 将本地项目关联到远程仓库$ git push -u [shortname] [分支名](git push -u origin master)

知识点总结:

  • 即使是个人项目,也建议关联远程仓库,防止电脑出意外
  • 远程仓库github很慢,建议选择国内的,gitee等
  • 可以使用Gitlab搭建自己的远程仓库
  • 相关git命令:push, pull, git clone, git remote
  • 两种方式:SSH(推荐),用户密码
————————

Code Association git remote warehouse

Create a new project on the remote repository (via gitee)

Associate a local item to a remote warehouse

# 在当前目录新建一个Git代码库$ git init# 添加当前目录的所有文件到暂存区$ git add .# 提交暂存区到仓库区$ git commit -m [message]# 增加一个新的远程仓库,并命名$ git remote add [shortname] [url(SSH)]# 将本地项目关联到远程仓库$ git push -u [shortname] [分支名](git push -u origin master)

< strong > summary of knowledge points: < / strong >

  • Even for personal projects, it is recommended to associate with remote warehouses to prevent computer accidents
  • The remote warehouse GitHub is very slow. It is recommended to choose domestic, gitee, etc
  • You can use gitlab to build your own remote warehouse
  • 相关git命令:push, pull, git clone, git remote
  • Two methods: SSH (recommended) and user password