赞
踩
仅供本人记录查阅
全网最丝滑的 本地仓库上传GitHub操作 (Git建立本地仓库并上传代码到GitHub中)-------摆脱繁琐和冗余 清晰明了!!
全网最丝滑的 Git克隆远程仓库操作 (Git克隆远程仓库并上传代码到远程仓库中)-------摆脱繁琐和冗余 清晰明了!!
ssh -T git@github.com
git config --global user.name "EliasJie"
git config --global user.email "meiyouyudi@qq.com"
ssh-keygen -t rsa -C "meiyouyudi@qq.com"
93254@WIN11DC MINGW64 ~/Desktop
$ ssh-keygen -t rsa -C "meiyouyudi@qq.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/93254/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/93254/.ssh/id_rsa
Your public key has been saved in /c/Users/93254/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:7jECk2ix0lWMXzSEDFG4J8jzfBLBzmn5jDVNijzpDQk meiyouyudi@qq.com
The key's randomart image is:
+---[RSA 3072]----+
| o.. o*+. |
| ..E B o. |
| . .o O X + |
| . = .= ^ = . |
|. = + *S% . |
| o o .* = |
| . +o |
| o o |
| . |
+----[SHA256]-----+
93254@WIN11DC MINGW64 ~/Desktop
$ ssh -T git@github.com
The authenticity of host 'github.com (20.405.243.196)' can't be established.
ED25519 key fingerprint is SHA456:+DiY3wvvVfduJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'github.com' (ED25519) to the list of known hosts.
Hi EliasJie! You've successfully authenticated, but GitHub does not provide shell access.
93254@WIN11DC MINGW64 ~/Desktop
$
本人以前写的
四. 克隆远程仓库 (核心操作)
现在写的
git status
93254@WIN11DC MINGW64 ~/Desktop/OpenMV_Software (main)
$ git status
On branch main
Your branch is up to date with 'origin/main'.
Untracked files:
(use "git add <file>..." to include in what will be committed)
OpenMV peripheral/
Project/
ei_object_detection.py
labels.txt
nothing added to commit but untracked files present (use "git add" to track)
git add .
git add .
git commit -m 'first commits'
第一次会让输入git的邮箱、用户名,输入一下git commit -m 'First commits'
git push
将本地仓库中的提交(commits)推送到远程仓库93254@WIN11DC MINGW64 ~/Desktop/OpenMV_Software (main)
$ git push
Enumerating objects: 65, done.
Counting objects: 100% (65/65), done.
Delta compression using up to 20 threads
Compressing objects: 100% (54/54), done.
Writing objects: 100% (64/64), 130.36 KiB | 379.00 KiB/s, done.
Total 64 (delta 2), reused 2 (delta 0), pack-reused 0 (from 0)
remote: Resolving deltas: 100% (2/2), done.
To github.com:EliasJie/OpenMV_Software.git
3ebb816..004f36f main -> main
问题:如出现 error: failed to push some refs to
To github.com:EliasJie/Share-library.git
! [rejected] main -> main (fetch first)
error: failed to push some refs to 'github.com:EliasJie/Share-library.git'
hint: Updates were rejected because the remote contains work that you do not
hint: have locally. This is usually caused by another repository pushing to
hint: the same ref. If you want to integrate the remote changes, use
hint: 'git pull' before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
解决:先git pull
,后git push
git pull
git push
93254@WIN11DC MINGW64 ~/Desktop/Share-library (main) $ git pull
remote: Enumerating objects: 5, done. remote: Counting objects: 100%
(5/5), done. remote: Compressing objects: 100% (2/2), done. remote:
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 Unpacking
objects: 100% (3/3), 978 bytes | 81.00 KiB/s, done. From
github.com:EliasJie/Share-library 9da07f1…e3e8276 main ->
origin/main Merge made by the ‘ort’ strategy. README.md | 4 ++± 1
file changed, 3 insertions(+), 1 deletion(-)
93254@WIN11DC MINGW64 ~/Desktop/Share-library (main) $ git push
Enumerating objects: 19, done. Counting objects: 100% (15/15), done.
Delta compression using up to 20 threads Compressing objects: 100%
(9/9), done. Writing objects: 100% (9/9), 451.71 KiB | 1.29 MiB/s,
done. Total 9 (delta 2), reused 0 (delta 0), pack-reused 0 (from 0)
remote: Resolving deltas: 100% (2/2), completed with 2 local objects.
To github.com:EliasJie/Share-library.git e3e8276…e5746f1 main -> main
本人以前写的
删除Github中没有用的仓库
进入到需要删除的仓库里面,找到“settings”即仓库设置,
然后,在仓库设置里拉到最底部,找到“Danger Zone”即危险区域,
点击“Delete this repository”这样就可以删除该仓库了。
我们知道,在Github上我们只能删除仓库,并不能删除文件或者文件夹,所以只能用命令来解决。
新建文件夹
git bash here
在新建的文件夹里右键git bash here打开终端,并执行git init初始化仓库
git clone <你的地址>
找到github上要删除的仓库地址,并复制,在终端里输入git clone <你的地址>
假如要删除GitHub的Project2此文件夹
在终端里输入dir查看此文件夹下的文件和目录(文件夹)
git rm <filename>
git rm -r <filename>
我们要删除GitHub的Project2此文件夹
git commit -m "XXXX"
git checkout
git push
刷新github仓库 就看见选定删除的文件夹没有了!!!大功告成!
错误
error: remote origin already exists.
git remote -v
git remote rm origin
我这里出现错误
fatal: unable to access ‘https://github.com/Noroom569/text.git/’: OpenSSL SSL_read: Connection was reset, errno 10054
git config --global http.sslVerify "false"
以后有问题继续扩充:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。