git使用

三世轮回 提交于 2019-11-28 13:24:56

原文引用https://www.dazhuanlan.com/2019/08/25/5d625c65cd50c/


2019-8-15

从git上克隆项目到本地

git clone url

连接远程仓库并提交代码到github

  • 配置用户名和邮箱
git config --global user.name "your name"
git config --global user.email "your email address"
  • 连接远程仓库
git remote add origin https://github.com/smilechenjia/vuepress.git
  • 创建空的本地仓库
git init 
  • 将项目所有文档添加到缓存中
git add .
  • 将缓存中的代码提交到本地仓库
git commit -m "注释"
  • 上传代码到远程库
git push --set-upstream origin master
  • 从仓库拉取代码到本地 cd 到文档夹
git pull origin master 

生成ssh key并添加到github

  • 生成公钥和私钥
ssh-keygen -t rsa -C "github用户名"
  • 查看公钥
cat ~/.ssh/id_rsa.pub
  • 添加ssh key 登陆github,依此点击头像->settings->new SSH

把新生成的公钥复制粘贴到这里

新建分支

git checkout -b branchname
git push origin branchname:branchname

删除分支

git push origin --delete branchname
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!