原创博客:转载请标明出处: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. OC内存管理

    内存问题 野指针异常:访问所有权的内存,如果想要安全访问,必须确保空间还在(确保访问的内存不是僵尸对象) 内存泄露:空间使用完之后没有及时释放 过度释放:对一块空间释放多次,立刻crash 内存溢出: ...

  2. Centos配置SS5代理

    wget http://heanet.dl.sourceforge.net/project/ss5/ss5/3.8.9-8/ss5-3.8.9-8.tar.gz tar xvf ss5-3.8.9-8 ...

  3. sprig里的controller之间的跳转的问题

    学习spring的controller,发现controller之间的跳转有些地方搞的不是很清楚,如果通过controller的return语句实现跳转的话,会造成request的丢失:具体怎么回事首 ...

  4. Html5-canvas

    Html5-canvas: 坐标是x向右,逐步增大, y坐标向下增大,原点在画布的左上角.长度单位是一个像素: 像素是一个密度单位,而厘米是长度单位,两者无法比较: Html5的绘图函数: 2.    ...

  5. Ubuntu下freeradius的EAP-MD5,PEAPv0/EAP-MSCHAPv2,EAP-TTLS/MD5,EAP-TTLS/MSCHAPv2方式认证(基于mysql)

    基于freeradius+mysql,今天验证下freeradius的EAP认证:1.EAP-MD5:2.EAP-PEAP 一.EAP-MD5方式认证 1.修改配置文件 (1)/usr/local/e ...

  6. Win7下Hyenae的安装

    (1)下载 链接:http://sourceforge.net/projects/hyenae/   资源:hyenae-0.36-1_fe_0.1-1-win32.exe (2)README --- ...

  7. NAT123内网映射端口

    在无内网路由管理员权限的情况下,需要将内网web应用暴露到公网访问,此时需要用到花生壳或者nat123(两个应用都不是免费的,其中花生壳可以8元认证,以后免费使用,nat123按天收费) 花生壳 ht ...

  8. google 账号登陆chrome内容是中文的问题

    最近要用到google accout使用某项服务,奇怪的是之前是英文,登陆后就显示中文了,我把浏览器默认的语言和电脑的系统语言改了也无济于事,最好还是google 帮忙解决了,原来我的google a ...

  9. ldap + kerberos 整合

    第一部分:ldap1. 安装ldap yum install -y openldap openldap-clients openldap-servers openldap-devel 2. 配置lda ...

  10. 第十一&十二&十三周周记

    周数 专业学习目标 专业学习时间 新增代码量 博客发表量 人文方面的学习 知识技能总结 第十一周 认真学习网络技术,了解路由器和交换机之间的联通和使用. 一天一小时 300 一篇 每天用一小时看关于经 ...