git 只添加cpp文件

1.问题

 计划添加所有子文件夹中的cpp文件,每个子文件夹包含格式如下:

 2. .gitignore文件

https://blog.csdn.net/qq_35077107/article/details/111319351

https://www.cnblogs.com/springwind2006/p/7753589.html

/**/.settings/
/**/Debug/
/**/.cproject
/**/.project

  1. ! 开头的模式标识否定,该文件将会再次被包含,如果排除了该文件的父级目录,则使用 ! 也不会再次被包含。可以使用反斜杠进行转义(?)

出现很多警告:

warning: LF will be replaced by CRLF in 112. 路径总和/112. 路径总和.cpp.
The file will have its original line endings in your working directory

CRLF -- Carriage-Return Line-Feed 回车换行

LF--换行

应该是我命名出现的问题吧。无所谓了。

git add .
git status #查看
git commit - m "1104"
git push origin main

3.问题

首先遇到超时的问题:

fatal: unable to access 'https://github.com/***.git/': Failed to connect to github.com port 443 after 21124 ms: Timed out

尝试如下命令:

git config --global --unset http.proxy 
git config --global --unset git.proxy

错误变为:

fatal: unable to access 'https://github.com/***.git/': OpenSSL SSL_read: Connection was reset, errno 10054

https://www.cnblogs.com/lvhuayan/p/14538106.html

产生原因:一般是这是因为服务器的SSL证书没有经过第三方机构的签署,所以才报错

尝试如下命令:

git config --global http.sslVerify "false"

却出现超时的问题,和错误1一样。

又尝试命令:

git config --global --unset http.proxy 
git config --global --unset https.proxy

但是又报SSL的错误,在这套娃呢?同样运行false命令,仍然出现了超时的错误。说明尝试没用。

https://programmerah.com/solved-git-error-openssl-ssl_read-connection-was-reset-errno-10054%E5%92%8Cfailed-to-connect-to-github-com-port-443-31249/,根据这个链接的说明,关掉代理服务器,可以弹出登录窗口,我选择在浏览器登录,输入密码后不行,仍然显示超时,

选择sign in with a code,仍然:

git clone https://github.com/***/Leetcode.git
Cloning into 'Leetcode'...
warning: ----------------- SECURITY WARNING ----------------
warning: | TLS certificate verification has been disabled! |
warning: ---------------------------------------------------
warning: HTTPS connections may not be secure. See https://aka.ms/gcmcore-tlsverify for more information.

fatal: 发送请求时出错。
fatal: 无法连接到远程服务器
fatal: 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。 20.205.243.166:443

哭了,开代理出现443超时,不开代理出现上面的问题,天有绝人之路啊。

https://blog.csdn.net/cake_eat/article/details/109277876,按照这个方式,关闭上面对话框,输入GitHub邮箱和密码,仍然出现443超时。。。

然后再尝试就直接全是443了,对话框也出不来了,本地没有开代理。

最终选择:

git clone git@github.com:***/Leetcode.git

可以成功clone。。。。

原文地址:https://www.cnblogs.com/BlueBlueSea/p/15510759.html