原创博客:转载请标明出处: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

  1. 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管理代码的更多相关文章

  1. ios 开发中使用SVN管理代码

    今天新公司需要使用SVN管理代码,就在网上查看相关的资料,现在把相关用法记录下来: 1.使用的是这个软件Cornerston 网上有很多相应的下载链接,可以去查看 2.下载安装之后,首先需要添加仓库r ...

  2. 使用GIT来管理代码的心得

    使用GIT来管理代码,第一步当然就是下载一个GIT客户端(不知道是不是这么叫,但是觉得和客户端的功能差不多).电脑的操作系统是windows7的,所以下的是对应的GIT. 就是这玩意,安装的时候不停的 ...

  3. github的初次体验及管理代码的心得

    周六早上的课上,助教给我们演示了一遍如何上传和下载代码库,新建代码库等等,但是是在linux上的,而我的笔记本的操作系统是win7的.而在教室中的尝试因为网络原因,虽然可以上github的网站,但是下 ...

  4. 用开源中国(oschina)Git管理代码(整合IntelliJ 13.1.5)

    简介 开源中国提供了Git服务(地址:http://git.oschina.net/),在速度上比国外的github要快很多.使用了一段时间,感觉很不错.oschina git提供了演示平台,可以运行 ...

  5. 使用git建立本地仓储管理代码【转】

    转自:http://blog.csdn.net/airk000/article/details/7738231 Git是Linus大神的代码管理工具,简直说是开发者的超级福音,而作为屌丝的个人开发者, ...

  6. JAE京东云引擎Git上传管理代码教程和京东云数据库导入导出管理

    文章目录 Git管理准备工作 Git工具上传代码 发布代码装程序 mywebsql管理 京东云引擎小结   JAE京东云引擎是京东推出的支持Java.Ruby.Python.PHP.Node.js多语 ...

  7. intelliJ IDEA之使用svn或git管理代码

    intelliJ IDEA之使用svn管理代码 1.VCS—>import into Version Control—>Share Project(Subversion) 2.点击+    ...

  8. 如何使用git管理代码

    如何使用Git管理代码 Git 是开发人员用来向代码库(msstash)中提交代码或者下载远端代码库中代码的工具. 如何使用git向代码库中提交我们修改后的代码呢? 1.如果是第一次使用git,那么需 ...

  9. windows下使用git管理代码,其中出现的问题的解决办法

    和朋友共同开发一个小项目,所以就涉及到了代码管理这块,刚开始想到的是使用svn,但是外网访问svn的时候需要使用花生壳来弄一个动态的域名,中间出了很多错误,感觉有点麻烦,所以就想到看看还有别的管理代码 ...

随机推荐

  1. C# 大小写转换,方便index of

    ToUpper:小写转大写ToLower:大写转小写 例: string str=120cm*150g/m2;从中取出120和150,但是又要规避大小写问题,这时候就需要将str转换为大写,然后ind ...

  2. sja1000T can相关的知识

    开发环境:硬件环境arm9200 sja1000T,软件环境kernel version 2.6.21.驱动程序:字符驱动 can有两种基本的工作模式:basic can .pelican,pelic ...

  3. unslider.js 实现移动web轮播

    unslider.js可以实现轮播,但是在移动端还需要另两个插件. jquery.event.move和jQuery.event.swipe : 下面就是简单的实例: <!doctype htm ...

  4. Python的平凡之路(14)

    一.什么是HTML HTML(Hyper Text Mark-up Language ) 即超文本标记语言,是 WWW 的描述语言,由 Tim Berners-lee提出.设计 HTML 语言的目的是 ...

  5. 北大poj-1081

    You Who? Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 801   Accepted: 273 Descriptio ...

  6. Android深度探索--HAL与驱动开发----第八章读书笔记

    通过蜂鸣器的实现原理,实现一个完整的蜂呜器驱动,可以打开和关闭蜂鸣器. PWM驱动的实现方式不同于LED驱动, PWM 驱动将由多个文件组成.这也是大多数 Linux 驱动的标准实现方式. 刚开始是L ...

  7. Android深度探索--HAL与驱动开发----第五章读书笔记

    第五章主要学习了搭建S3C6410开发板的测试环境.首先要了解到S3C6410是一款低功耗.高性价比的RISC处理器它是基于ARMI1内核,广泛应用于移动电话和通用处理等领域. 开发板从技术上说与我们 ...

  8. django进行model字段的自定义

    相信大家一定有web应用被攻击的经历,数据库安全是一个网站的必须课.django有很好的orm,但sql注入,或其他方式的攻击都是无法完全屏蔽的. 所以一般数据库都会对用户数据,如text类型的数据进 ...

  9. 基于.NET的CAD二次开发学习笔记一:CAD开发入门

    1.AutoCAD .NET API由不同的DLL文件组成,它们提供用于访问图形文件或AutoCAD应用程序的包含丰富的类.结构.方法和事件.每一个DLL文件都定义不同的使用基于功能的库组织组件的命名 ...

  10. 初接触BurpLoader工具

    初接触burp工具 菜鸟一枚,现在在接触一段时间测试,我在测试功能性的时候,想着网站被黑案例那么多,我是不是也应该弄弄安全性测试了,所以就有了下边的第一次接触BurpLoader工具来测试手机的app ...