logo小熊博客
首页 代码速查表 fk标记语言示例 登录
目录
ubuntu安装git、提交代码

安装Git,设置账号信息

sudo apt update
sudo apt install git
git --version
git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"

生成git密钥

ls -al ~/.ssh
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

测试SSH连接

ssh -T git@github.com

#4 返回信息
Hi username! You've successfully authenticated, but GitHub does not provide shell access.

提交项目

git init
git add .
git commit -m "提交"

推送项目

git remote -v  //检查当前远程仓库 URL
git remote set-url origin git@github.com/xxxxxxx    //修改远程仓库为 SSH URL
git push -u origin master  

拉取项目

//查看分支
git branch -r 

//拉取master 分支代码               
git pull origin master

//切换main分支
git checkout main       

//拉取main分支代码
git pull origin main       
上一篇:签到功能部分代码
下一篇:设置定时任务
请我喝奶茶!
赞赏码
手机扫码访问
手机访问