Git_Github设置与使用
2012-04-14 22:04
211 查看
参考网址:http://kylecordes.com/2008/git-windows-go
Global setup:
Set up git git config --global user.name "Your Name" git config --global user.email xxx@163.com
Next steps:
mkdir ctsaProject cd ctsaProject git init touch README git add README git commit -m 'first commit' git remote add origin git@github.com:xxx/ctsaProject.git git push -u origin master
Existing Git Repo?
cd existing_git_repo git remote add origin git@github.com:xxx/ctsaProject.git git push -u origin master
Importing a Subversion Repo?
Check out the guide for step by step instructions.
When you're done:
Continue
////////////////////////////////////
使用GitHub步骤: 1、申请GitHub帐户 xxx ,创建名为new-project的新Repository 2、安装Git客户端(Linux) #yum install git git-gui 3、 生成密钥对,这样项目可以push到 GitHub上 #ssh-keygen -t rsa -C "xxx@gmail.com" 4、将.ssh/id_rsa.pub拷贝到GitHub网站 5、为了方便,设置ssh不输入口令 # eval `ssh-agent` # ssh-add (输入passphrase) 6、测试是否能联通GitHub #ssh git@github.com 如果配置正确,显示 ERROR: Hi xxx! You've successfully authenticated, but GitHub does not provide shell access Connection to github.com closed. 7、设置Git全局用户配置 # git config --global user.name "xxx" # git config --global user.email xxx@gmail.com 8、创建本地新项目工作树 # mkdir new-project # cd new-project # git init # touch README # git add README # git commit -m 'first commit' 定义远程服务器别名origin # git remote add origin git@github.com:xxx/new-project.git 本地和远程合并,本地默认分支为master # git push origin master GitHub网站上就可以看见了, http://github.com/xxx/new-project 9. 更新文件 # vi README 自动commit更改文件 # git commit -a 更新至远程 # git push origin master 10. 创建和合并分支 #git branch 显示当前分支是master #git branch new-feature 创建分支 # git checkout new-feature 切换到新分支 # vi page_cache.inc.php # git add page_cache.inc.php Commit 到本地GIT # git commit -a -m "added initial version of page cache" 合并到远程服务器 # git push origin new-feature 如果new-feature分支成熟了,觉得有必要合并进master #git checkout master #git merge new-feature #git branch #git push 则master中也合并了new-feature 的代码 再登录到GitHub可以看见"Switch Branches"下的分支选项: GitHub还有一个很实用的功能,查看开发进程网络图(Network):
相关文章推荐
- (转)在公司的局域网使用git或github 设置代理
- 设置Github,使用https:// 来替换 git://
- Git的使用(本地仓库的设置,文件添加,关联github远程仓库)
- linux mint上推送更新至github的设置,以及git使用(blog)
- Git设置及GitHub的使用
- Git SSH设置及GitHub的使用
- Set Up Git - GitHub使用设置
- 在mac上使用github--设置git
- Git设置及GitHub的使用 (转)
- Github——Git设置及GitHub的使用
- 在公司的局域网使用git或github 设置代理
- 在mac上使用github--设置git
- 在mac上使用github--设置git
- git&github使用笔记(二)——Git设置文件忽略
- windows 使用git 远程连接到github
- Android Studio如何使用github和git管理项目
- git与github在ubuntu下的使用
- Git/Github的使用并与Eclipse整合
- 来自 Github 的图形化 Git 使用教程