|
楼主 |
发表于 2013-8-14 20:40:50
|
显示全部楼层
本帖最后由 beiyuuyieb 于 2013-8-14 20:41 编辑
自己已解决, 只能用用ssh clone(https clone也会断),具体步骤:
1. 用ssh或者xshell生成密钥对id_dsa_1024.pub和id_dsa_1024,把公钥内容粘贴到github.com上自己的账户里,把私钥id_dsa_1024拷贝到~/.ssh/id_dsa_1024下
2. 执行以下命令给ssh客户端安装私钥
# ssh-agent bash
# ssh-add
Enter passphrase for /root/.ssh/id_dsa:
Identity added: /root/.ssh/id_dsa_1024 (/root/.ssh/id_dsa_1024)
3. 测试和git服务器的密钥验证是否正常
#ssh -T git@github.com
Hi yourusername! You've successfully authenticated, but GitHub does not provide shell access.
4. 在git网站服务器上建立Repository,名字为cb2, 所以路径就是git@github.com:yourusername/cb2.git
5. 建立本地代码文件夹
# mkdir -p /home/code/git/cb2
# cd /home/code/git/cb2
# git config --global user.name yourusername
# git config --global user.email yourmail
# git config --global credential.helper cache
# touch README.md
# git init
# git add README.md
# git commit -m "first commit"
# git remote add origin git@github.com:yourusername/cb2.git
# git push -u origin master
Counting objects: 3, done.
Writing objects: 100% (3/3), 209 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
To git@github.com:yourusername/cb2.git
* [new branch] master -> master
Branch master set up to track remote branch master from origin.
6. 在git网站上浏览要下载的代码branch,在网页右侧clone URL的地方点SSH,标题就变成SSH clone URL,然后复制这个URL链接
# git clone git@github.com:cubieboard2/linux-sunxi.git
等待clone完成即可 |
|