当前位置:   article > 正文

ubuntu下git的安装及使用_ubuntu 安装git-cola

ubuntu 安装git-cola

sudo apt-get install git

mkdir ~/git

cd ~/git

git config --global user.name  "xxxx"

git config --global user.email "xxxx@xxx.com"


配置ssh


colamachine@ubuntu:~/git$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/colamachine/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/colamachine/.ssh/id_rsa.
Your public key has been saved in /home/colamachine/.ssh/id_rsa.pub.
The key fingerprint is:
xxxxxxxxxxxxxxxxxxxxx colamachine@ubuntu
The key's randomart image is:

xxxxxxxx


新创建的sshkey 记得添加到当前系统中 


# ssh-add   ~/.ssh/id_rsa 

不然系统是不认可的

colamachine@ubuntu:~/git$ cat ~/.ssh/id_rsa.pub 

将里面的公钥交给管理员,当然这里面我们是搭建了一个git私服,我们登陆内网git网站

http://192.168.1.1:8000/huashan-group/merchant-manage

输入用户名密码,profile setting->ssh Key ->add ssh key 

把id_rsa.pub 里的内容拷贝进去

然后再命令行里输入

colamachine@ubuntu:~/git$ git clone git@192.168.10.147:huashan-group/merchant-manage.git

会弹出一个unlock ssh key 的输入框 ,输入 之前填写的密码

然后

Cloning into 'merchant-manage'...
The authenticity of host '192.168.10.147 (192.168.10.147)' can't be established.
RSA key fingerprint is aa:7d:d2:9a:41:36:e8:30:f0:a0:96:c6:2b:ec:83:e4.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.10.147' (RSA) to the list of known hosts.
remote: Counting objects: 3182, done.
remote: Compressing objects: 100% (2158/2158), done.
remote: Total 3182 (delta 1629), reused 1514 (delta 678)
Receiving objects: 100% (3182/3182), 49.12 MiB | 1.77 MiB/s, done.
Resolving deltas: 100% (1629/1629), done.
Checking connectivity... done.


下载完成


切入刚下载的目录

colamachine@ubuntu:~/git$ git branch
colamachine@ubuntu:~/git$ cd merchant-manage/
colamachine@ubuntu:~/git/merchant-manage$ ls
pom.xml  src
colamachine@ubuntu:~/git/merchant-manage$ git branch
* master
colamachine@ubuntu:~/git/merchant-manage$ git remote
origin

但是由于目前我开发的项目是在dev分支上 所以我还得把dev分支down下来


olamachine@ubuntu:~/git/merchant-manage$ git checkout -b dev origin/dev
Branch dev set up to track remote branch dev from origin.
Switched to a new branch 'dev'
colamachine@ubuntu:~/git/merchant-manage$ git branch
* dev
  master


现在我们就能用eclipse 在这个版本上开发了


重新ssh key gen 之后 发现有问题

現在的 ssh 使用同樣的方法會出現錯誤訊息

Agent admitted failure to sign using the key


解決方式 使用 ssh-add 指令将私钥 加进来 (根据个人的密匙命名不同更改 id_rsa)
# ssh-add   ~/.ssh/id_rsa 




声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/从前慢现在也慢/article/detail/506339
推荐阅读
相关标签
  

闽ICP备14008679号