Git更新本地项目

  1. 1. Git更新本地项目
    1. 1.1. 关联 后更新只要执行步骤2、3、5、6。
      1. 1.1.1. …or create a new repository on the command line
      2. 1.1.2. …or push an existing repository from the command line
        1. 1.1.2.0.0.1. fatal: unable to access ‘https://github.com/xxxxxx/xxxxx': OpenSSL SSL_read: Connection was reset, errno 10054

Git更新本地项目

1、(先进入项目文件夹)通过命令 git init 把这个目录变成git可以管理的仓库

1
git init

2、把文件添加到版本库中,使用命令 git add .添加到暂存区里面去,不要忘记后面的小数点“.”,意为添加文件夹下的所有文件

1
git add .

3、用命令 git commit告诉Git,把文件提交到仓库。引号内为提交说明

1
git commit -m 'first commit'

4、关联到远程库

1
git remote add origin 你的远程库地址

如:

1
git remote add origin https://github.com/cade8800/ionic-demo.git

5、获取远程库与本地同步合并(如果远程库不为空必须做这一步,否则后面的提交会失败)

1
git pull origin master

6、把本地库的内容推送到远程,使用 git push命令,实际上是把当前分支master推送到远程。执行此命令后会要求输入用户名、密码,验证通过后即开始上传。

1
git push -u origin master

*、状态查询命令

1
git status

关联 后更新只要执行步骤2、3、5、6。

git官方指南:

…or create a new repository on the command line

1
2
3
4
5
6
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin xxxx
git push -u origin main

…or push an existing repository from the command line

1
2
3
git remote add origin xxxx
git branch -M main
git push -u origin main

补充

fatal: unable to access ‘https://github.com/xxxxxx/xxxxx': OpenSSL SSL_read: Connection was reset, errno 10054

解决方法:

git config --global http.sslVerify false