git之github笔记
来源:互联网 发布:大数据 普惠金融 论文 编辑:程序博客网 时间:2024/06/07 02:58
参考文章:
http://www.cnblogs.com/fnng/archive/2012/01/07/2315685.html
http://rangercyh.blog.51cto.com/1444712/749490/
1、注册github账号,安装windows版本git工具
2、在github New Repository
3、连接github,使用命令ssh-keygen –t rsa –C “jsjlgl@126.com”生成公钥,默认位置在个人文档的.ssh里面,复制id_rsa.pub中的文字到github的ssh key中
4、在使用命令ssh –T git@github.com测试是否连接上时,命令行报错Bad file number,参考第二篇文章添加config文件,将端口号指向443,可以成功连接了
5、因为我在创建Repository的时候github引导我创建了REDME和.gitignore文件,所以我想先将项目下载下来,将我原有的文件添加进去再上传
6、使用命令git clone git@github.com:liguanliang2014/dian24.git clone项目到当前文件夹,发现它又在我创建的dian24里面弄了一个dian24文件夹,重复了,下次注意。将我原来项目的代码和资源复制到了这里
7、使用命令git status查看当前的状态
8、使用git add 命令添加要提交的文件或文件夹
9、使用git commit -m"提交时的说明" 命令提交更改到本地。这里有个问题,一开始我直接使用git commit提交,进入一个类似vim的编辑界面,让我输入本次提交的说明,but我输完不知道怎么退出编辑,强行把命令窗口关了,哎
9、使用命令git push -u origin master将更改提交到github
#2016-01-07修改
我使用eclipse的git插件想要再次提交项目的时候,直接提交出现错误:rejected - non-fast-forward错误,找到解决方法(http://stackoverflow.com/questions/22636772/eclipse-repository-state-conflict-error),贴到这里:
I had this same problem and I was able to fix it. afk5min was right, the problem is the branch that you pulled code from has since changed on the remote repository. Per the standard git practices(http://git-scm.com/book/en/Git-Basics-Working-with-Remotes), you need to (now) merge those changes at the remote repository into your local changes before you can commit. This makes sense, this forces you to take other's changes and merge them into your code, ensuring that your code continues to function with the other changes in place.
Anyway, on to the steps.
Configure the 'fetch' to fetch the branch you originally pulled from.
Fetch the remote branch.
Merge that remote branch onto your local branch.
Commit the (merge) change in your local repo.
Push the change to the remote repo.
In detail...
In eclipse, open the view 'Git Repositories'.
Ensure you see your local repository and can see the remote repository as a subfolder. In my version, it's called Remotes, and then I can see the remote project within that.
Look for the green arrow pointing to the left, this is the 'fetch' arrow. Right click and select 'Configure Fetch'.
You should see the URI, ensure that it points to the remote repository.
Look in the ref mappings section of the pop-up. Mine was empty. This will indicate which remote references you want to fetch. Click 'Add'.
Type in the branch name you need to fetch from the remote repository. Mine was 'master' (btw, a dropdown here would be great!!, for now, you have to type it). Continue through the pop-up, eventually clicking 'Finish'.
Click 'Save and Fetch'. This will fetch that remote reference.
Look in the 'Branches' folder of your local repository. You should now see that remote branch in the remote folder. Again, I see 'master'.
Right-Click on the local branch in the 'Local' folder of 'Branches', which is named 'master'. Select 'Merge', and then select the remote branch, which is named 'origin/master'.
Process through the merge.
Commit any changes to your local repository.
Push your changes to the remote repository.
Go have a tasty beverage, congratulating yourself. Take the rest of the day off.
- git之github笔记
- git/github学习笔记--之二
- Git&GitHub学习笔记之(一)GitHub简单操作
- Git&GitHub学习笔记之(二)Git命令操作
- git/github学习笔记
- git/github学习笔记
- git/github学习笔记
- git/github学习笔记
- git/github学习笔记
- git/github学习笔记
- git/github学习笔记
- git/github学习笔记
- git/github学习笔记
- git/github学习笔记
- git/github学习笔记
- git/github学习笔记
- git/github学习笔记
- git/github学习笔记
- allegro学习--区域约束
- Spring MVC 容器中设置Bean属性值 为NULL
- tomcat部署war,启动访问不到工程,需要启动两次(<Context path=""..../>)
- 第一次写博客
- 为NGSOS智能操作系统设计编程语言
- git之github笔记
- 对于学习Android系统移植方法的探讨(一)----linux内核移植
- UVa #1395 Slim Span (例题11-2)
- android屏幕分辨率 的获取
- Makefile include
- 记录一些平时用的工具用法及命令(1)
- web.xml组件加载顺序
- 欢迎使用CSDN-markdown编辑器
- Java 的三种循环:foreach,Iterator 和 classic for loop