Ubuntu下git使用教程
来源:互联网 发布:图片加音乐制作软件 编辑:程序博客网 时间:2024/06/05 07:54
安装git
sudo apt-get install git
检查SSH
GitHub用到了SSH,需要在shell里检查是否连接到GitHub:
willard@willard-PC~/github/blog $ ssh -T git@github.comHi willard-yuan! You've successfully authenticated, but GitHub does not provide shell access.
上面表明添加成功。
克隆rep
比较常见的将远程版本库中的代码clone到本地的方式如下:
git clone git@github.com:willard-yuan/blog.git
其他常用Git命令
git init # 初始化本地Git版本库git add # 暂存文件,如果使用.表示当前目录及其子目录git commit -m “first commit” # 提交,-m选项后跟内容为提交所用的注释git remote -v # 查看当前项目远程连接的是哪个版本库地址git push origin master # 将本地项目提交到远程版本库git fetch origin # 取得远程更新(到origin/master),但还没有合并git merge origin/master # 把更新的内容(origin/master)合并到本地分支(master)git pull origin master # 相当于fetch和merge的合并,但分步操作更保险git branch -r #查看分支git checkout origin/master(gh-pages) #切换分支git push origin :branch_you_want_to_delete #删除远程分支(注意空格,把一个空的branch赋值给已有的branch,这样就删除了)
示例
willard@willard-PC~/github $ git clone git@github.com:willard-yuan/pcvwithpython.gitCloning into 'pcvwithpython'...remote: Reusing existing pack: 1960, done.remote: Total 1960 (delta 0), reused 0 (delta 0)Receiving objects: 100% (1960/1960), 58.58 MiB | 2.10 MiB/s, done.Resolving deltas: 100% (671/671), done.Checking connectivity... done.
克隆下来后,便可以对项目的文件进行修改添加,修改添加完成后,提交到远程版本控制库:
willard@willard-PC~/github/pcvwithpython $ git add .willard@willard-PC~/github/pcvwithpython $ git commit -m "update content in ch07"[gh-pages 221c8bc] update content in ch07 1 file changed, 4 insertions(+)
在push之前,我们先来查看一下当前项目远程连接的是哪个版本库地址:
willard@willard-PC~/github/pcvwithpython $ git remote -vorigin git@github.com:willard-yuan/pcvwithpython.git (fetch)origin git@github.com:willard-yuan/pcvwithpython.git (push)
然后push:
git push
注意,这里本小子并没有用git push origin master
,用该命令,出现下面错误:
willard@willard-PC~/github/pcvwithpython $ git push origin masterWarning: Permanently added the RSA host key for IP address '2001:778:0:ffff:64:0:c01e:fc83' to the list of known hosts.error: src refspec master does not match any.error: failed to push some refs to 'git@github.com:willard-yuan/pcvwithpython.git
暂时就这样吧。
Reference:
[1].Ubuntu下GitHub的使用
[2].在Ubuntu下配置舒服的Python开发环境
from: http://yongyuan.name/blog/the-trick-of-using-git.html
0 0
- Ubuntu下git使用教程
- ubuntu下使用git
- Ubuntu下 git 使用
- Ubuntu下git使用
- Ubuntu下Git使用
- ubuntu下使用git
- Linux下git使用教程
- Git Windows下使用教程
- linux 下git使用教程
- windows下git 使用教程
- Ubuntu下git简单使用
- Ubuntu下git简单使用
- ubuntu 下git 使用注意
- ubuntu下git使用总结
- Ubuntu下git使用过程
- ubuntu下git安装使用
- ubuntu下使用git, github
- ubuntu 下git的使用
- Android Android屏幕亮度设置
- YUV格式与RGB格式的换算
- 图像傅里叶变换
- mysql链接jdbc.URL参数的设置
- :/coolpigs//Visual Studio 2010 "工具">"选项"中的VC++目录编辑功能已被否决
- Ubuntu下git使用教程
- Android学习笔记(六) 调整手机屏幕亮度Brightness seekbar实现
- JSP用common-fileupload实现文件上传下载
- <iOS>十进制数转换成其他进制数
- 【cas、tomcat】SunCertPathBuilderException: unable to find valid certification path to requested target
- 开发PHP扩展CDT插件安装
- screen brightness seekbar not working
- 使用nodejs,express,mysql,Bootstrap开发采购招标网站(一)项目搭建
- netlink_unicast return -11 (EAGAIN)