[ git ] git托管代码
来源:互联网 发布:皂基洗面奶知乎 编辑:程序博客网 时间:2024/05/16 13:54
久闻git大名,但是一直不知道为何物。现在认真的过了一遍。原来是和svn一样的版本控制器。
具有速度快,分布式管理等优点。
现在就来看看git的使用过程,我这里是用开源中国来托管代码的,如果是使用github也是一样的。
1 先下载git for windows
然后一直点下一步安装.
2 安装之后,选择git gui.生成ssh 链接 git 公钥.
用命令也可以:
$ ssh-keygen -t rsa -C "your_emali@youemal.com"
然后输入密码.
建议用第一种方式。第二种网上说是可以,但是我没成功过。
然后输入密码。
3 将公钥添加到开源中国上,或者是github中
在开源中国中新建一个公钥,然后将.ssh文件夹下的id_ras_pub中的内容复制到文本框中,这里的title可以随意.
https://help.github.com/articles/generating-ssh-keys
4 测试链接:
输入命令:$ ssh -T git@git.oschina.net
然后输入yes
如果成功可以看到你的用户名和邮箱.
出现错误可以测试:$ ssh -Tv git@git.oschina.net
5 设置用户名和邮箱
$ git config user.name"you name"
$git config user.email"you_email@youemal.com"
6 然后在web开源中国中创建一个project.
7 测试上传文件
创建文件夹,需要和你建立的projexct同名。
mkdir hello
cd hello
git init
touch README
git add README
git commit -m 'frist commit'
8 提交
git remote add test git@git.oschina.net:web用户名/hell.git
git push -u test master
如里有报错误:
- To git@git.oschina.net:yangzhi/hello.git
- ! [rejected] master -> master (fetch first)
- error: failed to push some refs to 'git@git.oschina.net:yangzhi/hello.git'
- hint: Updates were rejected because the remote contains work that you do
- hint: not have locally. This is usually caused by another repository pushin
- hint: to the same ref. You may want to first merge the remote changes (e.g.
- hint: 'git pull') before pushing again.
- hint: See the 'Note about fast-forwards' in 'git push --help' for details.
git push -f
可以ok了.
10 克隆代码
git clone git@github..com:用户名/项目名.git
转自:http://blog.csdn.net/yangzhihello/article/details/9855997
- [ git ] git托管代码
- [ git ] git托管代码1
- [ git ] git托管代码2
- 【Git】代码托管
- GIT代码托管SVN
- 代码托管:git
- Git 托管代码
- Git代码托管平台
- git代码托管平台
- Git托管代码
- Git托管现有代码
- git代码托管常用命令
- Git托管代码快速入门
- 代码托管(Git、Github)_store1
- 国内代码托管平台(Git)
- 国内代码托管平台(Git)
- Git 代码托管-项目上传
- 常用GIT代码托管平台
- 在 CentOS 7.0 上源码安装 Xen 4.5
- android,北风网沈大海新浪微博项目笔记
- Google的C++编码规范(总结)
- [Phonegap+Sencha Touch] 移动开发19 某些安卓手机上弹出消息框 点击后不消失的解决办法
- 【算法学习笔记】06.数据结构基础 队列与堆栈初步
- [ git ] git托管代码
- C++ GDI+ DrawImage方法详解(绘制指定图像Image)
- [Phonegap+Sencha Touch] 移动开发20 IOS7状态栏问题
- scala学习十三 开发twitter客户端
- 100+V6(爱奇艺手机) root教程_方法
- 黑马程序员_动态代理
- Android:图片压缩类ThumbnailUtils
- 配置C程序的编译环境,及怎样演示Demo
- POJ 1159