代码托管仓库之码云
码云是一个代码托管仓库,作为编程人员,大家应该都听过过或使用过github吧,如果说github是全世界编程者的代码仓库,码云是实际上就是中国的github,github由于服务器在外国,可能在国内我们访问速度回非常慢,而码云作为国内最常用的仓库之一,速度和友好型方面自然会号很多。
首先注册一个账号,之后可以创建一个仓库
gitee入门
Git 全局设置:
git config --global user.name "张亚飞" git config --global user.email "1271570224@qq.com"
创建 git 仓库:
mkdir lstm-crf cd lstm-crf git init touch README.md git add README.md git commit -m "first commit" git remote add origin https://gitee.com/zhangyafeii/lstm-crf.git git push -u origin master
已有仓库?
cd existing_git_repo git remote add origin https://gitee.com/zhangyafeii/lstm-crf.git git push -u origin master
出现错误
$ git push -u origin master
To git@gitee.com:zhangyafeii/ordering_system.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'git@gitee.com:zhangyafeii/ordering_system.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
解决
$ git pull origin master --allow-unrelated-histories 此时会有一个弹窗,提示你修改一个文档的内容,不用管他,按ESC键 再按SHIFT+; (SHIFT+;用来输入一个冒号) 再输入wq!保存 $ git push -u origin master # 成功!
添加ssh公钥
本地操作
# 1. 生成一对ssh秘钥
ssh-keygen -t rsa -C '1271570224@qq.com@gitee.com 提示输出保存文件路径及文件名(默认/c/Users/fei/.ssh/id_rsa):gitee_user(可根据需要修改)
输入两次git密码
# 2. 查看公钥 cat gitee_user.pub
# 3. 测试SSH,运行
ssh -T git@gitee.c Hi 张亚飞! You've successfully authenticated, but GITEE.COM does not provide shell access.