github官网(GitHub 使用指南)

懵懂先生 网文资讯github官网(GitHub 使用指南)已关闭评论201阅读模式

文章源自略懂百科-http://wswcn.cn/18951.html

1. 创建github账号文章源自略懂百科-http://wswcn.cn/18951.html

浏览器搜索 github 或 直接打开网址 https://github.com 进入 github 如下账号创建页面文章源自略懂百科-http://wswcn.cn/18951.html

具体步骤可参考官网的教程地址:https://help.github.com/articles/create-a-repo/文章源自略懂百科-http://wswcn.cn/18951.html

如果一切顺利,输入邮箱、密码等,大约30 秒即可完成账号创建。文章源自略懂百科-http://wswcn.cn/18951.html

2. 创建仓储:文章源自略懂百科-http://wswcn.cn/18951.html

仓储(repository),理解为管理各种文件的仓库。进入个人github页面,点击右上角头像,在下拉栏选文章源自略懂百科-http://wswcn.cn/18951.html

择 Your repositories, 随后页面跳到仓储面完成创建。文章源自略懂百科-http://wswcn.cn/18951.html

如创建仓储 blog, git 地址:https://github.com/user2items/blog.git文章源自略懂百科-http://wswcn.cn/18951.html

3. 创建本地3.1 安装 Git:文章源自略懂百科-http://wswcn.cn/18951.html

首先我们需要先下载Git,这里最好下载最新版本的 Git,网址:https://git-scm.com/downloads, 安装时如果没有特殊需求,一直下一步就可以了,安装完成之后,双击打开Git Bash。文章源自略懂百科-http://wswcn.cn/18951.html

3.2 Git 设置:文章源自略懂百科-http://wswcn.cn/18951.html

配置:cd XXXuser2items文章源自略懂百科-http://wswcn.cn/18951.html

git config --global user.name "此处为你的github的用户名"git config --global user.email "此处为你的邮箱"git config --global user.name "XXXXX"git config --global user.email "XXXX.com"文章源自略懂百科-http://wswcn.cn/18951.html

这里输入的用户名和电子邮件是任意的,这些信息只是用来记录是谁进行了修改。可以通过输入git config --list查看配置的信息。文章源自略懂百科-http://wswcn.cn/18951.html

公钥:文章源自略懂百科-http://wswcn.cn/18951.html

ssh key$ cd ~/.ssh , 查询是否存储公钥ssh-keygen -t rsa -C "此处为你的邮箱"$ ssh-keygen -t rsa -C "XXXXX.com"文章源自略懂百科-http://wswcn.cn/18951.html

创建公钥名称为user2items(可以不写)Enter file in which to save the key (/c/Users/DELL/.ssh/id_rsa): user2items文章源自略懂百科-http://wswcn.cn/18951.html

发现有2个文件:user2items.pub 和 user2items文章源自略懂百科-http://wswcn.cn/18951.html

记事本打开user2items.pub, 复制内容到github :文章源自略懂百科-http://wswcn.cn/18951.html

点击头像进入Settings -> SSH and GPG keys -> New SSH key,将复制的信息粘贴到该处。文章源自略懂百科-http://wswcn.cn/18951.html

测试:文章源自略懂百科-http://wswcn.cn/18951.html

$ ssh -T git@github.comHi user2items! Youve successfully authenticated, but GitHub does not provide shell access.文章源自略懂百科-http://wswcn.cn/18951.html

3.3 上传代码到远端仓储:文章源自略懂百科-http://wswcn.cn/18951.html

git init 初始化git add . 添加当前位置的全部文件, 注意 "."git remote add origin xxx 添加远端仓储,origin 为远端在本地的服务主机名称,xxx 为远端url地址git commit -m "注释语句" 提交到本地仓储git push -u origin master 从本地上传github文章源自略懂百科-http://wswcn.cn/18951.html

4. git 常见命令文章源自略懂百科-http://wswcn.cn/18951.html

1) 远程仓库相关命令文章源自略懂百科-http://wswcn.cn/18951.html

检出仓库:$ git clonehttps://github.com/user2items/paperClub.git文章源自略懂百科-http://wswcn.cn/18951.html

查看远程仓库:$ git remote -v文章源自略懂百科-http://wswcn.cn/18951.html

添加远程仓库:$ git remote add [name]

文章源自略懂百科-http://wswcn.cn/18951.html

删除远程仓库:$ git remote rm [name]文章源自略懂百科-http://wswcn.cn/18951.html

修改远程仓库:$ git remote set-url --push [name] [newUrl]文章源自略懂百科-http://wswcn.cn/18951.html

拉取远程仓库:$ git pull [remoteName] [localBranchName]文章源自略懂百科-http://wswcn.cn/18951.html

推送远程仓库:$ git push [remoteName] [localBranchName]文章源自略懂百科-http://wswcn.cn/18951.html

2)分支(branch)操作相关命令文章源自略懂百科-http://wswcn.cn/18951.html

查看本地分支:$ git branch文章源自略懂百科-http://wswcn.cn/18951.html

查看远程分支:$ git branch -r文章源自略懂百科-http://wswcn.cn/18951.html

创建本地分支:$ git branch [name] 创建后不会自动切换为当前分支文章源自略懂百科-http://wswcn.cn/18951.html

切换分支:$ git checkout [name]文章源自略懂百科-http://wswcn.cn/18951.html

创建新分支并立即切换到新分支:$ git checkout -b [name]文章源自略懂百科-http://wswcn.cn/18951.html

删除:$ git branch -d [name] ---- -d选项只能删除已经参与了合并的分支,对于没有合并的分支是无法删除的。如果想强制删除一个分支,可以使用-D选项文章源自略懂百科-http://wswcn.cn/18951.html

合并分支:$ git merge [name] ----将名称为[name]的分支与当前分支合并文章源自略懂百科-http://wswcn.cn/18951.html

创建远程分支(本地分支push到远程):$ git push origin [name]文章源自略懂百科-http://wswcn.cn/18951.html

删除远程分支:$ git push origin :heads/[name] 或 $ gitpush origin :[name]文章源自略懂百科-http://wswcn.cn/18951.html

参考:https://blog.csdn.net/dengsilinming/article/details/8000622文章源自略懂百科-http://wswcn.cn/18951.html

文章源自略懂百科-http://wswcn.cn/18951.html

懵懂先生
  • 本文由 发表于 2022年8月2日 09:56:03
  • 转载请注明:http://wswcn.cn/18951.html
网文资讯

一吨等于多少斤(一吨等于多少斤是几年级的)

吨是重量单位,又是质量单位,但是两者相比较,学生对重量单位这个词语容易理解,就拿填空题来说,问你所学习的质量单位有哪些跟你学习的质量单位有哪些,同样的答案,不同的问法。学生的错误率是不一样的。 吨这个...
网文资讯

玛瑙(世界上最美的玛瑙湖)

遍地都是玛瑙却被认为是石头?行家捡走一颗卖1.3亿,就在我国 如果问你们,世界上最贵的宝石是什么,许多人都会想到钻石。钻石有着宝石之王的美誉,深受人们的喜爱。但实际上,一些出类拔萃的玛瑙的价值也丝毫不...
网文资讯

9月19日全国疫情最新通报(31个省43例新确诊病例)

2022年8月11日11时,拉萨市民就近接受核酸检测,井然有序。中国日报 达穷摄 中国日报网8月11日拉萨电(记者达穷 华旦尼玛)记者从西藏自治区应对新型冠状病毒感染的肺炎疫情工作领导小组办公室8月1...
网文资讯

p站网址(全球百大流量网站榜出炉)

100个规模最大的网站 Visualcapitalist网站报道,随着发展越来越迅速,互联网前所未有地成为人们生活的一部分,全球百大网站的用户流量爆炸性增长且依旧在持续。想要挤进这全球百大网站名单,网...