github上传文件
git remote add origin https://github.com/Ineedstrong/socket-practice.git如果不行的情况下
git remote set-url origin git@github.com:Ineedstrong/socket-practice.git
就以这种方式
3. 使用 SSH 替代 HTTPS(推荐)
绕过 HTTPS 的 TLS 问题:
生成 SSH 密钥:
bash
ssh-keygen -t ed25519 -C "your_email@example.com" # 回车使用默认路径
将公钥添加到 GitHub:
复制公钥内容:
bash
cat ~/.ssh/id_ed25519.pub
在 GitHub: Settings → SSH and GPG keys → New SSH key 中粘贴。
将远程 URL 改为 SSH:
bash
git remote set-url origin git@github.com:Ineedstrong/socket-practice.git
重新推送:
bash
git push -u origin main