使用Githua管理代码
原创博客:转载请标明出处:http://www.cnblogs.com/zxouxuewei/
1、安装配置git服务器
a、安装ssh,因为git是基于ssh协议的,所以必须先装ssh:
sudo apt-get install openssh-server openssh-client
b, 安装好ssh后,启动ssh服务:
sudo /etc/init.d/ssh restart
c、安装git服务器:
sudo apt-get install git-core
Checking for existing SSH keys
(1) Open Terminal.
(2) Enter ls -al ~/.ssh to see if existing SSH keys are present:
ls -al ~/.ssh
#Lists the files in your .ssh directory, if they exist
(3) Check the directory listing to see if you already have a public SSH key.
出现 github 为私钥,github.pub为公钥。
Generating a new SSH key
(1) Open Terminal.
(2) Paste the text below, substituting in your GitHub email address.
ssh-keygen -t rsa -b -C "your_email@example.com"
# Creates a new ssh key, using the provided email as a label
**Generating public/private rsa key pair.**
(3) When you’re prompted to “Enter a file in which to save the key,” press Enter. This accepts the default file location.
Enter a file in which to save the key (/Users/you/.ssh/id_rsa): [Press enter]
(4) At the prompt, type a secure passphrase. For more information, see “Working with SSH key passphrases”.
Enter passphrase (empty for no passphrase): [Type a passphrase]
Enter same passphrase again: [Type passphrase again]
Adding your SSH key to the ssh-agent
Before adding a new SSH key to the ssh-agent, you should have checked for existing SSH keys and generated a new SSH key.
(1) Ensure ssh-agent is enabled:
# start the ssh-agent in the background
eval "$(ssh-agent -s)"
Agent pid
(2) Add your SSH key to the ssh-agent. If you used an existing SSH key rather than generating a new SSH key, you’ll need to replace id_rsa in the command with the name of your existing private key file.
$ ssh-add ~/.ssh/id_rsa
(3)Add the SSH key to your GitHub
- Copy the SSH key to your clipboard.
If your SSH key file has a different name than the example code, modify the filename to match your current setup. When copying your key, don’t add any newlines or whitespace.
$ sudo apt-get install xclip
# Downloads and installs xclip. If you don't have `apt-get`, you might need to use another installer (like `yum`)
$ xclip -sel clip < ~/.ssh/id_rsa.pub
# Copies the contents of the id_rsa.pub file to your clipboard
Tip: If xclip isn’t working, you can locate the hidden .ssh folder, open the file in your favorite text editor, and copy it to your clipboard.
在账户的profile里,选择SSH KEYS 选项,然后Add SSH Key,将~/.ssh/id_rsa.pub中的内容复制进去,上传成功后,会收到确认邮件。 可以使用ssh -v git@github.com命令来测试链接是否畅通。
2.In the top right corner of any page, click your profile photo, then click Settings.
3.In the user settings sidebar, click SSH and GPG keys
4.Click New SSH key.
5.In the “Title” field, add a descriptive label for the new key. For example, if you’re using a personal Mac, you might call this key “Personal MacBook Air”.
The key field
6.Paste your key into the “Key” field.
7.Click Add SSH key.
8.Confirm the action by entering your GitHub password.
设置账户信息
git config --global user.name “lukeyan”
git config --global user.email xxx@gmail.com
设置成功后,用Terminal用ssh命令访问GitHub,会显示一条认证成功的消息并退出。
ssh -T git@github.com
执行后提示:

经过以上几步设置就可以直接使用git命令访问github的代码仓库了。
3.提交代码至GitHub
首先,在github.com上创建一个新的repo,根据情况加上适当的.gitignore,LICENSE等,然后提交本地代码至github
git init
git status
git add ./ git commit -m "init files"
git remote add origin git@github.com:yourgithubname/yourrepositoryname.git git push -u origin master
3.提交代码至SVN
.显示SVN文件与目录:
svn ls https://192.168.1.68/svn/Probot/ZhouXueWei/ --username ZhouXueWei .CheckOut程序
svn co https://192.168.1.68/svn/Probot/ZhouXueWei/ /home/zxwbot/commend/ .svn更新代码
svn up keysi_package/ .添加代码
svn add ./test .上传代码
svn commit -m "test" .删除远程文件
svn delete update
svn commit -m "Deleted file 'update'."
使用Githua管理代码的更多相关文章
- ios 开发中使用SVN管理代码
今天新公司需要使用SVN管理代码,就在网上查看相关的资料,现在把相关用法记录下来: 1.使用的是这个软件Cornerston 网上有很多相应的下载链接,可以去查看 2.下载安装之后,首先需要添加仓库r ...
- 使用GIT来管理代码的心得
使用GIT来管理代码,第一步当然就是下载一个GIT客户端(不知道是不是这么叫,但是觉得和客户端的功能差不多).电脑的操作系统是windows7的,所以下的是对应的GIT. 就是这玩意,安装的时候不停的 ...
- github的初次体验及管理代码的心得
周六早上的课上,助教给我们演示了一遍如何上传和下载代码库,新建代码库等等,但是是在linux上的,而我的笔记本的操作系统是win7的.而在教室中的尝试因为网络原因,虽然可以上github的网站,但是下 ...
- 用开源中国(oschina)Git管理代码(整合IntelliJ 13.1.5)
简介 开源中国提供了Git服务(地址:http://git.oschina.net/),在速度上比国外的github要快很多.使用了一段时间,感觉很不错.oschina git提供了演示平台,可以运行 ...
- 使用git建立本地仓储管理代码【转】
转自:http://blog.csdn.net/airk000/article/details/7738231 Git是Linus大神的代码管理工具,简直说是开发者的超级福音,而作为屌丝的个人开发者, ...
- JAE京东云引擎Git上传管理代码教程和京东云数据库导入导出管理
文章目录 Git管理准备工作 Git工具上传代码 发布代码装程序 mywebsql管理 京东云引擎小结 JAE京东云引擎是京东推出的支持Java.Ruby.Python.PHP.Node.js多语 ...
- intelliJ IDEA之使用svn或git管理代码
intelliJ IDEA之使用svn管理代码 1.VCS—>import into Version Control—>Share Project(Subversion) 2.点击+ ...
- 如何使用git管理代码
如何使用Git管理代码 Git 是开发人员用来向代码库(msstash)中提交代码或者下载远端代码库中代码的工具. 如何使用git向代码库中提交我们修改后的代码呢? 1.如果是第一次使用git,那么需 ...
- windows下使用git管理代码,其中出现的问题的解决办法
和朋友共同开发一个小项目,所以就涉及到了代码管理这块,刚开始想到的是使用svn,但是外网访问svn的时候需要使用花生壳来弄一个动态的域名,中间出了很多错误,感觉有点麻烦,所以就想到看看还有别的管理代码 ...
随机推荐
- 用jQuery Mobile做HTML5移动应用的三个优缺点
JQuery Mobile 和 HTML5 的 3个优点 1. 上手迅速并支持快速迭代:在一个星期多一点的时间里,通过阅读JQuery Mobile文档以及O’Reilly出版的JQuery Mobi ...
- asp.net生成随机密码
public string RandCode(int n) { char[] arrChar = new char[]{ 'a','b','d','c','e','f','g','h','i','j' ...
- 方法的重载overload
/*方法的重载overload * 重载:在同一个类里可以定义一个或者一个以上的方法 * 参数类型不一致 * 参数数量不一致 * */ public class Chongza ...
- c++ 中的sort用法
别人写的,我拿来做做笔记 sort函数的用法 做ACM题的时候,排序是一种经常要用到的操作.如果每次都自己写个冒泡之类的O(n^2)排序,不但程序容易超时,而且浪费宝贵的比赛时间,还很有可能写错.ST ...
- linux自动更新代码,打包发布
1.安装svn yum install subversion 2.安装 maven 下载:百度云盘地址为 http://pan.baidu.com/s/1nuKQGjv 解压 tar -zxvf ap ...
- X3850M2安装CertOS 7 KVM
在旧的X3850中安装linux系统,研究KVM. 通过选择fedora和centos测试,最终选择centos7来安装. 先安装了一台,安装第二台时又出现第一台的问题,决定记录下来防止记忆出错. 1 ...
- 【python】3.x,string与bytes的区别(文本,二进制数据)
Python 3对文本和二进制数据作了更为清晰的区分.文本总是Unicode,由str类型表示, 二进制数据则由bytes类型表示. 不能拼接字符串和字节包,也无法在字节包里搜索字符串(反之亦然),也 ...
- 华为手机调试显示log日志
华为手机默认状态手机log为关闭状态,所以看不到详细错误信息. 手机拨号*#*#2846579#*#*,进入projectmenu--后台设置--LOG设置--LOG开关--打开 勾选AP日志 C ...
- matlab初学之句柄
文章出处:http://www.cnblogs.com/CBDoctor/archive/2012/04/06/2434072.html 在matlab中,每一个对象都有一个数字来标识,叫做句柄.当每 ...
- Android 图片浏览器 从原来位置放大至全屏显示
android 图片浏览器 特点: 1.从网络加载图片,只需要传图片地址数组即可 2.点击图片,从原来位置放大至全屏 3.支持手势操作 4.完全自定义布局 项目源码请到GitHub下载:https:/ ...