Git第一次本地代码提交到远程仓库

要先确定前面是否已经存在仓库

git remote -v

如果存在,删除原有的仓库

git remote rm origin

1、git仓库初始化

git init

2、本地仓库连接到远程仓库

git remote add origin [remote url]

3、查看当前状态

git status

4、将代码添加到暂存区

git add .

此步骤报错warning: LF will be replaced by CRLF in 文件地址

提交时转换为LF,检出时转换为CRLF

git config --global core.autocrlf true

5、将代码添加到仓库

git commit -m 'first commit'

6、将本地代码提交到远程仓库

git push origin master

如果报错,使用强制提交,git push -f origin master

如果报错fatal: unable to access ‘https:..‘OpenSSL SSL_read:.....属于ssl认证失败的问题,使用git config --global http.sslVerify "false"跳过认证。在push

git config --global http.sslVerify "false"

你可能感兴趣的:(git,git)