GitHub使用方法
git下载地址:https://git-scm.com/downloads 下一步下一步就好了
在cmd输入 git --version
在桌面空白右键 Git Bash Here命令行
输入 git --version
在https://github.com/注册一个账号
配置sshkey
cd ~/.ssh
ll 查看下所有的目录
进入命令 cd /
ssh-keygen -t rsa -C "1341376695@qq.com"一直回车,不用管
ll
下面多了2个文件
pwd
cat id_rsa.pub
查看复制
title随便起个什么名字就好
2.配置多个sshkey
cd ~/.ssh
vim config 没有的话,vim就创建了一个
Host github.com
HostName github.com
User 这个就是user填写的地址
IdentityFile 填写的是id_rsa的绝对路径
3.在gitup创建项目
打开命令行
mkdir muke
cd muke
git clone git@github.com:xuzhongtao/test1.git 仓库克隆到本地
cd AutoTest 进入仓库
vim test.txt
输入一些内容
cat test.txt
git status 查看本地仓库文件状态
git add test.txt报错
解决办法:
$ rm -rf .git // 删除.git $ git config --global core.autocrlf false //禁用自动转换
然后重新执行:
$ git init $ git add 文件名
it中报unable to auto-detect email address 错误的解决拌办法
** Please tell me who you are.
Run
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
fatal: unable to auto-detect email address (got 'tim@newton.(none)')
后来找到了解决办法:
找到工程目录的.git文件夹,打开之后找到config文件,在最后边加上一句话
[user]
email=your email
name=your name
your email 和your name随便写上就行
git status
git commit -m "增加测试文件" 增加本次提交文件的说明 回车
git push 推送到gitup网站上
报错
fatal: No configured push destination.
Either specify the URL from the command-line or configure a remote repository using
git remote add <name> <url>
and then push using the remote name
.或在命令行上创建一个新的存储库
git init git add README.md git commit -m“first commit” git remote add origin https://github.com/xuzhongtao/test1.git git push -u origin master
...或从命令行推送现有存储库
git remote add origin https://github.com/xuzhongtao/test1.git git push -u origin master
-------------------------------------------------------------------------
git pull 拉取
4.项目分支
git branch 查看本地分支
git branch -a 查看远程端的分支明令 多了一行
git checkout -b branch1 在本地创建分支
vim test.text 编辑这个文件
保存 退出
git add test.txt
git commit -m "提交到分支1的内容"
git push 提交
git push --set-upstream origin branch1
5.分支操作--删除分支
git branch -d branch1 删除本地分支 不能删除自已使用得分支
git checkout master 切换master
git branch -r -d origin/branch1 删除远程的分支
git push origin :branch1 origin后面有一个空格 删除远程的分支
6.git合并分支
git checkout -b mergedemo 创建一个分支
git merge mergedemo 合并分支
7.git项目操作
git add . 更新所有的文件
git reset --hard HEAD^ 回退到上一个版本
git reset --hard HEAD^ 回退到上上一个版本
git reset --hard HEAD~100 回退到上100一个版本
git reflog 版本的id号
git reset --hard 657a18 通过id号指定哪个版本
----------------------------------------------------------------------------------------------
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
解决办法:
$ git pull origin master
$ git push origin master
--------------------------------------------------------------------------------------------------------------
解决方法
可以通过如下命令进行代码合并【注:pull=fetch+merge]
git pull --rebase origin master
转载于:https://www.cnblogs.com/xuzhongtao/p/10092879.html
GitHub使用方法相关推荐
- git ssh创建分支_将git项目导入GitHub的方法(附创建分支)
前言:我们应该很多都会有自己的私有项目,大多情况都是存放在自己的硬盘中,今天我分享一下怎么讲自己的私有项目更新到GitHub上,这样再也不用担心项目丢失了. 一:下载git 下载链接 二:生成.ssh ...
- 免费CDN:jsDeliver+Github使用方法
免费CDN:jsDeliver+Github使用方法 CDN的全称是Content Delivery Network,即内容分发网络.CDN是构建在网络之上的内容分发网络,依靠部署在各地的边缘服务器, ...
- GitHub提速方法大揭秘,10M速度使用无忧
本文由 比特飞 原创发布,欢迎大家踊跃转载. 转载请注明本文地址:GitHub提速方法大揭秘,10M速度使用无忧 | .Net中文网. 1.概述 众所周知,GitHub在国内一直受到DNS污染的问题, ...
- GitHub使用方法(初级)
GitHub使用方法(初级) [初识Github] Git 是一个分布式的版本控制系统,最初由Linus Torvalds编写,用作Linux内核代码的管理.在推出后,Git在其它项目中也取得了很大成 ...
- github搜索方法
github搜索方法 in:name [example] 名字里含有example in:readme [example] readme里含有example in:description [examp ...
- github下载速度太慢linux,GitHub 下载速度慢?国内 GitHub 加速方法分享
GitHub 应该每个程序员都知道,一些 GitHub 上有的轮子我们也没必要再造,优秀的开源项目也值得我们学习.但是 GitHub 一个问题就是国内下载速度太慢,经常是下不动或者只有 10KB 的速 ...
- Github教程】史上最全github使用方法:github入门到精通
[Github教程]史上最全github使用方法:github入门到精通 [初识Github] 首先让我们大家一起喊一句"Hello Github".YEAH!就是这样. Git是 ...
- 如何使用jquery_免费CDN:jsDelivr+Github 使用方法
本文在CSDN上的链接:https://blog.csdn.net/qq_36759224/article/details/86936453 本文在我博客上的链接:https://www.itrhx. ...
- 【Mood 16 】史上最全github使用方法:github入门到精通
[初识Github] 首先让我们大家一起喊一句"Hello Github".YEAH!就是这样. Git 是一个分布式的版本控制系统,最初由Linus Torvalds编写,用作L ...
最新文章
- matlab figure函数的用法
- Unity3D手机斗地主游戏开发实战(02)_叫地主功能实现
- LeetCode 21. 合并两个有序链表(单链表)
- html禁止页面左右滑动,js阻止移动端默认事件以及只阻止横向滚动事件方法
- DST(对话状态追踪)常用方法
- Win10下Matlab r2018a 64位 中文破解版的安装以及破解方法
- 达摩达兰论估价pdf_应用公司理财PDF下载_(美)阿斯瓦斯・达摩达兰_机械工业出版社_会计_管理_零度图书网...
- 4k hidpi 黑苹果_黑苹果如何通过开启HIDPI来增强显示效果?
- 欧洲对地观测卫星和无人机发展现状简介
- CEMAPI实战攻略(二)——建立与短信信箱的连接
- 《并发数据结构与多核编程》作业题答案
- 使用redis的setnx可以非同一线程进行加锁和解锁(附源码)
- ZEALER王自如品味逼格感悟
- 计算机win7内容已满,win7c盘满了用了50G了怎么办
- IP地址及子网掩码介绍及计算详解
- VerifyCodeUtil 验证码工具类的使用
- %*s ,%.s ,%.*.s详解
- mysql hy000_mysql error[HY000][1366]解决办法
- 右手腕受伤给我的启示
- Chrome浏览器调试教程
热门文章
- python读取字典元素笔记_Python中列表、字典、元组数据结构的简单学习笔记
- 京东JIMI用户未来意图预测技术揭秘
- Android 8.0 中如何读取内部和外部存储以及外置SDcard
- Android中的人脸检测入门
- origin纵坐标如何改成百分制,origin作图时,坐标刻度默认向外,我知道如何改成向内,但每次改很麻烦,如何设置使刻度默认向内?...
- 学银在线python课程_Python 从入门到精通:一个月就够了!
- JZOJ 5167. 【NOIP2017模拟6.26】下蛋爷
- linux gnome3安装_Windows 10安装与管理WSL体验原生Linux系统
- html4.0编辑器,KindEditor HTML(在线编辑器)
- 数据挖掘在企业中应用的四种途径