TypechoJoeTheme

至尊技术网

统计
登录
用户名
密码
/
注册
用户名
邮箱

悠悠楠杉

网站页面

用Git上传项目到GitHub,并使用jsdelivr CDN

2021-01-05
/
0 评论
/
1,110 阅读
/
正在检测是否收录...
01/05

Git上传使用方法

先在你需要上传的目录右键选择Git Bash Here,然后执行以下代码

git init //同一个文件夹里只执行一次
git add . //如果想添加特定文件,把.换成对应的文件名就行了
git commit -m "first commit" //添加提交信息
git remote add origin https://github.com/用户名/仓库.git //git clone https://github.com/用户名/仓库.git (克隆现有的仓库)
git push -u origin master //第二次以后用git push origin master,如果需要覆盖方式可以用git push -f origin master

如果第一次操作,会出现需要输入邮箱和用户名的情况,执行以下的代码就好了

git config --global user.email "你的邮箱"
git config --global user.name "你的用户名"
git commit -m "first commit"

添加版本号上传

git init
git add .
git commit -m "first commit"
git remote add origin https://github.com/用户名/仓库.git
git push origin master //修改替换旧版本这段不用
git tag -a 1.0 -m "1.0" //添加版本号1.0
git push origin 1.0 //上传到1.0版本

提示问题

error: src refspec master does not match any
error: failed to push some refs to "https://github.com/..."
//没有用git commit 

On branch master
Your branch is up to date with 'origin/master'.
//版本分支的问题,用git branch检查有没有问题

error: remote origin already exists.
//远程源已经存在,用git remote rm origin删除远程源,在重新执行一遍

remote: Permission to xxx/xxx.git denied to xxx.
fatal: unable to access 'https://github.com/xxx/xxx.git/': The requested URL returned error: 403
//账号密码不对,在控制面板->用户->凭据管理器,找到GitHub保存的账号密码,编辑即可!

其他命令

git branch newbranch //新建一个分支
git branch //检查分支
git checkout newbranch //切换到你的新分支
git branch -M main //重名分支
git status //检查是否成功
git merge newbranch //将新分支提交的改动合并到主分支上
git branch -D newbranch //删除这个分支
git remote rm origin //删除远程 Git 仓库
git pull origin master //拉取远程仓库到本地

jsdelivr使用方法

//cdn.jsdelivr.net/gh/用户名/仓库名@版本号(非必须)/目录/文件

Git下载地址:https://zhizun.lanzoux.com/iesDFk28skd

经验CDNGitHubgitjsdelivr
朗读
赞(1)
版权属于:

至尊技术网

本文链接:

https://www.zzwws.cn/archives/4998/(转载时请注明本文出处及文章链接)

评论 (0)