使用git的ssh下载代码和文档

转载请标明出处:

http://blog.csdn.net/ouyida3/article/details/46470693

公司的云项目的代码和文档使用git管理,使用方法如下。

1、在电脑上安装git

略。

可参考[http://blog.csdn.net/ouyida3/article/details/44947745]{http://blog.csdn.net/ouyida3/article/details/44947745}中的第一部分-下载。

当然,如果你习惯了图形界面的方式,也可以安装乌龟版的Git,我同事试过,也是成功的。

2、生成自己的ssh的rsa的公钥和私钥

生成方法一

使用eclipse

Window-Preferences-General-Network Connection-SSH2-Key Managerment-Generate RSA Key

  • 生成的ssh-rsa这一段是公钥,可以给别人的;
  • Fingerprint可以忽略;
  • 点击Save Private Key可以保存私钥到你电脑里;
  • 把私钥和公钥文件放置在C:\Documents and Settings\Administrator.ssh下,也就是你打开Git Bash后的默认路径。一般公钥为id_rsa.pub,私钥为id_rsa,当然,可以改名的

Welcome to Git (version 1.9.5-preview20150319)

Run ‘git help git’ to display the help index.

Run ‘git help ’ to display help for specific commands.

[email protected] ~

$ pwd

/c/Documents and Settings/Administrator

生成方法二

打开Git Bash,输入:

ssh-keygen -t rsa -C "[email protected]"

会在/c/Documents and Settings/Administrator下生成.ssh目录,里面会生成一个公钥id_rsa.pub和私钥id_rsa。

注意,如果原来有这个目录,要重新生成,最好先把原来的文件删除。

测试ssh是否可用

生成公钥私钥后,你可以先测试一下

测试前需要你有gitbub帐号,然后登录github.com/settings/ssh中添加公钥

添加后在Git Bash中输入测试的命令:

[email protected] ~

$ ssh -T [email protected]

Hi ouyangda! You’ve successfully authenticated, but GitHub does not provide shell access.

出现这个提示,表示成功。后面的but不用管。

3、添加ssh key

给公钥发给公司git管理人员,让他把你的公钥添加到公司的git仓库中

PS:这一步骤我认为作用等同于上面你在自己帐号中添加公钥的作用,只是上面是针对仓库[email protected],而这里是针对公司的仓库

4、通过git下载代码

问同事拿到代码或文档库的路径,比如:

[email protected]:PaaS-DOC-DEV

然后打开Git Bash,进入你想下载保存的目录,输入以下命令回车即可。

git clone gitdoc01@10.1.228.198:PaaS-DOC-DEV

[email protected] /e/git/PaaS-DOC-DEV

$ git clone [email protected]:PaaS-DOC-DEV

Cloning into ‘PaaS-DOC-DEV’…

The authenticity of host ‘10.1.228.198 (10.1.228.198)’ can’t be established.

RSA key fingerprint is dc:a9:f1:e7:e4:18:e8:7d:70:da:93:98:aa:8a:73:2a.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added ‘10.1.228.198’ (RSA) to the list of known hosts.

remote: Counting objects: 903, done.

remote: Compressing objects: 100% (812/812), done.

remote: Total 903 (delta 544), reused 88 (delta 52)

Receiving objects: 100% (903/903), 379.81 MiB | 3.04 MiB/s, done.

Resolving deltas: 100% (544/544), done.

Checking connectivity… done.

2015.6.10

时间: 2024-08-07 10:42:59

使用git的ssh下载代码和文档的相关文章

【eclipse下使用git上传(下载)代码至(从)github】

eclipse下使用git插件上传代码至github 1.eclipse下安装git 正常情况下,eclipse 是自带 git 插件的,那么即可跳至步骤1的最后一小步,配置 git . 如果十分悲剧,你的 eclipse 中见不到 git 的身影,那么也没关系,安装一个 git 插件就行了.eclipse 安装插件的方法有好几种,此处选取最常见的一种介绍 git 插件的安装. 点击 Help->Install New Software->add. 输入插件名称(自定义),以及插件地址(htt

eclipse下使用git上传(下载)代码至(从)github

eclipse下使用git插件上传代码至github 1.eclipse下安装git 正常情况下,eclipse 是自带 git 插件的,那么即可跳至步骤1的最后一小步,配置 git . 如果十分悲剧,你的 eclipse 中见不到 git 的身影,那么也没关系,安装一个 git 插件就行了.eclipse 安装插件的方法有好几种,此处选取最常见的一种介绍 git 插件的安装. 点击 Help->Install New Software->add. 输入插件名称(自定义),以及插件地址(htt

怎么从git分支上下载代码

1. 在工作空间,右键,打开Git Bash 2. clone主分支的代码(即下载主分支代码的过程) 执行命令: git clone xxx.git 3. 进入工程目录 cd   xxx 4.I believe this occurs when you are trying to checkout a remote branch that your local git repo is not aware of yet. Try: git remote show origin 5.If the r

git 提交和下载代码

在github下需先 New repository 下载:进入程序工程目录下 如 cd f: cd ./Program\ Files/eclipse/workspace/IMoocMusic/ git clone https://github.com/liusp86/IMoocMusic 提交代码 第一次提交过程 将第一次clone 下的几个文件  LICENSE  .gitignore .git目录 拷贝到工程目录下 git add . git commit -m "First Commit&

vscode 使用git 上传下载代码

1.下载git https://git-scm.com/ VScode环境配置实现代码提示和括号自动补全功能 安装Anaconda 配置步骤:在编辑器的文件->首选项->设置->搜索git.path->点击编辑->找到你的电脑git的安装目录,找到里面的bin文件 夹,里面的git.exe文件把该文件的完整路径复制下来 2.创建git 本地仓库 创建daima目录 进入指定文件夹 执行git init 右击目录名字 git bash here 输入 git init 3. g

pycharm 中使用git上传下载代码

1.在pycharm中加入git客户端的安装路径 2.选择git管理工具 3. 4. 从服务器上更新和上传代码

Git使用SSH提交代码到server出现 permission denied (publickey).

在GitBush中向已经存在的Repository提交README.md改动. 命令例如以下: touch README.md git init git add README.md git commit -m "first commit" git remote add origin [email protected]:yunfuyiren/Test.gitgit push -u origin master 出现例如以下错误: 找了半天原因原来是没有安装SSH Key. 首先须要在cli

git从github下载代码

Github作为远程仓库的使用详解  http://blog.csdn.net/djl4104804/article/details/50778717 centos local:        通过git remote来设置远程仓库地址:        git remote add origin https://github.com/coder-pig/SimpleTea.git            假如你想修改远程仓库地址,比如你把仓库托管换成了[email protected],你需要修改

git用ssh方式下载和提交代码

之前git上传下载代码都是用的http方式,但是今天遇到个大文件上传的时候,http方式上传超出大小限制了413 request entity too large,所以改成了用ssh方式上传,简单记录下ssh的配置方式. 代码用Eclipse管理,用http方式的时候没什么特别的,直接clone输入地址和用户名密码即可,ssh的方式需要额外配置一下ssh key. 1.运行Git Bash客户端,执行ls ~/.ssh; 如果列出下图这两个rsa文件,那应该就不需要配置ssh key了,如果不放