省流:成功操作:
bug修复方法:
HP@VICTUS MINGW64 /f/PRP/RMMDet_manual (main)
$ ssh -T [email protected]
kex_exchange_identification: Connection closed by remote host
Connection closed by 20.205.243.166 port 22
HP@VICTUS MINGW64 /f/PRP/RMMDet_manual (main)
$ ssh -T [email protected]
Hi JameLanny! You've successfully authenticated, but GitHub does not provide shell access.
有时候在网页上登录并打开仓库了就能够成功
刚开始的小惊讶
既然是好东西,那就用呗
$ git clone https://github.com/********/Pre.git
很快啊,克隆到本地还是好操作的
实现远程提交的功能
使用的是HTTPS协议克隆仓库,是不需要配置SSH key的。HTTPS协议需要每次输入用户名和密码来进行代码操作。
但如果使用的是SSH协议克隆仓库,需要配置SSH key才能进行代码操作。配置SSH key的步骤如下:
- 打开终端(MacOS/Linux)或命令提示符(Windows),输入以下命令:
ssh-keygen -t rsa -b 4096 -C "[email protected]"
-
按照提示一路回车,生成SSH key。生成的SSH key默认保存在用户目录下的
.ssh
文件夹中。 -
打开生成的公钥文件(默认为
id_rsa.pub
),将公钥内容复制到github账户的SSH keys中。 -
测试SSH key是否配置成功,输入以下命令:
ssh -T [email protected]
如果提示Hi username! You've successfully authenticated, but GitHub does not provide shell access.
,则表示配置成功。
配置完成后,就可以使用SSH协议克隆仓库,并且不需要每次输入用户名和密码了。
HP@VICTUS MINGW64 /e/Users/HP/Desktop/Pre (main)
$ git add .
HP@VICTUS MINGW64 /e/Users/HP/Desktop/Pre (main)
$ git commit -m "add to files 4.17 evening"
[main c990bec] add to files 4.17 evening
2 files changed, 46 insertions(+)
create mode 100644 MC2_BGM.md
create mode 100644 MC3_THEME.md
HP@VICTUS MINGW64 /e/Users/HP/Desktop/Pre (main)
$ git push origin master
error: src refspec master does not match any
error: failed to push some refs to 'github.com:zzjc1234/Pre.git'
HP@VICTUS MINGW64 /e/Users/HP/Desktop/Pre (main)
$ git branch
* main
HP@VICTUS MINGW64 /e/Users/HP/Desktop/Pre (main)
$ git checkout -b master
Switched to a new branch 'master'
HP@VICTUS MINGW64 /e/Users/HP/Desktop/Pre (master)
$ git push origin master
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 16 threads
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 1.77 KiB | 1.77 MiB/s, done.
Total 4 (delta 0), reused 0 (delta 0), pack-reused 0
remote:
remote: Create a pull request for 'master' on GitHub by visiting:
remote: https://github.com/zzjc1234/Pre/pull/new/master
remote:
To github.com:zzjc1234/Pre.git
* [new branch] master -> master
这个时提交成功了