摘要:
关卡编号:L0G3000
关卡名称:Git基础知识
目录
一、闯关任务1:破冰活动:自我介绍
每位参与者提交一份自我介绍。 提交地址:https://github.com/InternLM/Tutorial 的 class 分支~
1.命名格式为 .md,其中 是您的报名问卷UID。
2.文件路径应为 ./icamp4/。
3.【大家可以叫我】内容可以是 GitHub 昵称、微信昵称或其他网名。
4.在 GitHub 上创建一个 Pull Request,提供对应的 PR 链接。
1. Git准备工作
下载Git-->配置Git
1.1 下载Git
使用指令git --version
验证是否成功
1.2 配置Git
使用指令(全局设置)
git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"
查看所有配置信息
git config --global --list
2. 正式做任务
Fork项目到自己账户–>创建分支–>提交修改内容
2.1 Fork项目到自己账户
配置git并克隆项目到本地(我这里是保存到本地)
git clone https://github.com/GojiLime/Tutorial.git
cd Tutorial/
git branch -a
git checkout -b class origin/class
2.2 创建分支
git checkout -b class_6379
创建新的分支
加入更改的信息
2.3 提交修改内容
git add .
git commit -m "add git_camp4_6379_introduction" # 提交信息记录,这里需要修改为自己的uid
git push origin class_6379
这时候可能会出现问题,由于开了VPN导致
Failed to connect to github.com port 443 after 21090 ms: Couldn‘t connect to server
参考博客解决Git连接失败
解决方法:
1.查看自己电脑系统端口: 打开“设置 -> 网络和Internet -> 代理”,记录下当前的端口号。
2.用命令把Git设置成自己电脑对于的端口
git config --global http.proxy 127.0.0.1:<你的端口号>
提交成功后在“Add a title中”输入 “add git_< id >_introduction”
二、闯关任务2: 实践项目:构建个人项目
创建并维护一个公开的大模型相关项目或笔记仓库。
提交作业时,提供您的 GitHub 仓库链接。
如果您不常使用 GitHub,您可以选择其他代码管理平台,如 Gitee,并提交相应的链接。
仓库介绍中添加超链接跳转 GitHub 仓库(https://github.com/InternLM/Tutorial)
将此项目报名参加第四期实战营项目评选将解锁 30% A100 和 168 团队算力点资源,报名链接:https://aicarrier.feishu.cn/wiki/JuXvwHzGni2A2Rksd8Rczpvxngb
1. 创建好repository
2. 用Git初始化一个README.md文件
git init git初始化
cd upscayl_Note/ 进入文件夹
echo “#upscayl_Note” >> README.md 搞一个README.md
git add README.md 添加README到暂存区
git commit -m “init repository & README.md” 提交更改
git branch -M main 把主分支的名字改为main
git remote add origin {你的远程仓库地址} 设置仓库的远程仓库
git push -u origin main 将本地分支 main 推送到远程仓库 origin,并且设置上游分支
这里会出现
(base) root@intern-studio-11208273:~/Mytasks/L0G3000/upscayl_Note# git push -u origin main
Username for 'https://github.com': GojiLime
Password for 'https://GojiLime@github.com':
remote: Permission to GojiLime/upscayl_Note.git denied to GojiLime.
fatal: unable to access 'https://github.com/GojiLime/upscayl_Note.git/': The requested URL returned error: 403
需要创建个人访问令牌(PAT)
再使用命令行就可以完成传输
git push https://<your_username>:<your_pat>@github.com/GojiLime/upscayl_Note.git
最终完成结果:
链接:https://github.com/GojiLime/upscayl_Note