git config --global user.name "jack"
git config --global user.email "jackluo@xxx.com"
Create a new repository
mkdir fromai_cn
cd fromai_cn
git init
touch README.md
git add README.md
git commit -m "first commit"
git remote add origin git@git.xxx.cn:develper/xxx_cn.git
git push -u origin master
Push an existing Git repository
cd existing_git_repo
git remote add origin git@git.xxxx.cn:develper/xxx_cn.git
git push -u origin master

这个是gitlab上面的配置

window 下安装 git 的客户端,全是google的地址这里提供一个 http://pan.baidu.com/s/1i3ACfe1

安装好后,因为 服务器的端口ssh不是22号所以

先来配置 ssh自动登陆

ssh-keygen -t rsa -C jackluo@xxxx.com

修改方法,修改当前用户的home下的.ssh/config文件

vim ~/.ssh/config

host example
hostname example.com
port
修改项目文件下的 .git/config 文件:
[core]
repositoryformatversion =
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
hideDotFiles = dotGitOnly
[remote "origin"]
url = git@example:develper/xxxx_cn.git
fetch = +refs/heads/*:refs/remotes/origin/*

最后把公钥添加到gitlab中

$ cat ~/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA1B0//oNYOKn6/SS2XyuMmCbys9bNlfuYvhLUYa9K989JuhSHhtnacCu+FdnL3XGQBrtFykjR+yHW3bNqqLa+oYJc12HOpTcgKLwWLROuy/5DLOaYatOxk0J4hk91zHINQKfcx0j/1aIFY9CZJWhdaUx48dhcIqSqskQrpaVC/uONliT5Xphr0HjdSI0wBLFPhTJrlzWOyA8FCvWDc93BydhJk3pwscFCaLH/69oi1BQQe+weweweXMsNv21+4kI5TDmDcgO5gagFyoq38TR2JM9khp1RO+5ekR/TW1qo9z1WJj6Phb9dazfL2wNaIGgfG1RNb0iNTQoGH+cOWBoL3/+jbQ== jackluo@xxxx.com
把这个复制 到 gitlab

My SSH keys 中


git push origin master

========================================================================

2. 生成ssh key时同时指定保存的文件名

ssh-keygen -t rsa -f ~/.ssh/id_rsa.sohu -C "email"

上面的id_rsa.sohu就是我们指定的文件名,这时~/.ssh目录下会多出id_rsa.sohuid_rsa.sohu.pub两个文件,id_rsa.sohu.pub里保存的就是我们要使用的key。

HOST fromai
hostname xxxxx
IdentityFile /home/jackluo/.ssh/id_rsa.fromai
port

3. 新增并配置config文件

添加config文件

如果config文件不存在,先添加;存在则直接修改

touch ~/.ssh/config

config文件里添加如下内容(User表示你的用户名)

Host *.cloudscape.sohu.com
IdentityFile ~/.ssh/id_rsa.sohu
User test
==============================================================================================
#Default Git
Host defaultgit
  HostName IP Address #域名也可
  User think
  IdentityFile ~/.ssh/id_rsa
 
#Second Git
Host secondgit
  HostName IP Address #域名也可
  User think
  IdentityFile ~/.ssh/id_rsa_second
 =========================================================

Bad owner or permissions on $HOME/.ssh/config

The ssh with RHEL 4 is a lot more anal about security checking. In my case, it was the fact that $HOME/.ssh/config was group-writable which was causing it to barf. To fix:

$ cd ~/.ssh
$ chmod 600 *
 

window下 配置gitlab ssh非端口22端口的更多相关文章

  1. window下配置SSH连接GitHub、GitHub配置ssh key

    window下配置SSH连接GitHub.GitHub配置ssh key   此经验分两部分: 第一部分介绍:在windows下通过msysGit(Git for windows.Git Bash)配 ...

  2. ssh-copy-id使用非默认22端口

    ssh-copy-id使用及非默认22端口时报错 ssh-copy-id使用介绍 说明:ssh-copy-id命令可以把本地的ssh公钥文件安装到远程主机对应的账户下. 功能:ssh-copy-id ...

  3. centos 7.0 修改ssh默认连接22端口 和 添加防火墙firewalld 通过端口

    首先 先做的就是 修改ssh的默认端口22 需要修改文件 /etc/ssh/sshd_config 使用命令 vi /etc/ssh/sshd_config [root@localhost ~]# v ...

  4. window 下配置wamp 环境

    PHP下载 下载php压缩包,几点注意:这里我安装的事apache 所以在 php官方下载页时不是随便下载的,不然可能配置不了apache! 注意我以下图片标注

  5. Window下配置NodeJs环境详解

        今年打算学习Web这块,所以就买了本Node.js+MongoDb+AngularJS这本书,这周天也比较忙,想着录视频(拍小片,不是AV,不要误会,是在线课程)的事情,这周又将Asp.Net ...

  6. linux ssh修改 默认22端口

    修改ssh 配置  /etc/ssh/sshd_config service sshd restart

  7. window下配置SSH连接GitHub、GitHub配置ssh key(转)

    转自:http://jingyan.baidu.com/article/a65957f4e91ccf24e77f9b11.html 此经验分两部分: 第一部分介绍:在windows下通过msysGit ...

  8. window下配置ssh key

    在windows下通过msysGit(Git for windows.Git Bash)配置SSH Keys连接GitHub. 1.检查本机是否有ssh key设置 $ cd ~/.ssh 或cd . ...

  9. ssh 和 scp 命令访问非默认22端口。

    ssh :(命令中的 p 小写) ssh -p 端口号 root@服务器ip scp: (命令中的 P 大写)(-r表示将目录下的目录递归拷贝.“.*”是将所有文件包括隐藏文件.) 上传文件到服务器s ...

随机推荐

  1. 向Word模板中填充数据

    现在有这样的需求,给Word文档的指定位置填充上特定数据,例如我们有一个终端,用来打印员工的薪资证明,对于一个公司来说,他的薪资证明模板是固定的,变化的地方是员工姓名,部门,职位等.我们只需要将这些指 ...

  2. 第十一篇:SOUI系统资源管理

    SOUI资源管理模块 从前篇已经讲到在SOUI中所有资源文件通过一个uires.idx文件进行索引. 这里将介绍在程序中如何引用这些资源文件. 在SOUI系统中,资源文件通过一个统一的接口对象读取: ...

  3. Android数据缓存(转)

    Android数据缓存   1.http://blog.csdn.net/lnb333666/article/details/8460159 2.https://github.com/Trinea/a ...

  4. 直接拿来用!最火的Android开源项目(一) (转)

    对于开发者而言,了解当下比较流行的开源项目很是必要.利用这些项目,有时能够让你达到事半功倍的效果.为此,CSDN特整理了GitHub上最受欢迎的Android及iOS开源项目,本文详细介绍了20个An ...

  5. ios二维码扫描

    1.添加AVFoundation.framework框架 2,控制器中实现 //第一步添加AVFoundation.framework框架 #import "ViewController.h ...

  6. ios 多文件上传

    /** *  上传多个文件 * *  @param url      请求接口地址 *  @param filedata 文件名称和数据(key:value) *  @param btnName  上 ...

  7. MFC 丢失MSVCR120D.dll 丢失mfc120ud.dll

  8. 通信原理实践(二)——幅度调制

    一.幅度调制,并画出时域和频域波形 1.代码如下: function [ p_n ] = AM_func( N,fs,fm,Am,fc,Ac,Ma ) %UNTITLED 此处显示有关此函数的摘要 % ...

  9. 用eclipse开发和调试postgresql-8.4.1

    按照书本<PostgreSQL数据库内核分析>根据第一章讲解的linux下,编译 安装:不同的是libreadline5-dev版本没有了,就用新的版本代替:我的ubuntu 14 所以必 ...

  10. ie上如何兼容placeholder

    首先,判断浏览器是否支持placeholder属性: var input = document.createElement('input'); if("placeholder" i ...