代码托管仓库之码云

码云是一个代码托管仓库,做为编程人员,你们应该都听过过或使用过github吧,若是说github是全世界编程者的代码仓库,码云是实际上就是中国的github,github因为服务器在外国,可能在国内咱们访问速度回很是慢,而码云做为国内最经常使用的仓库之一,速度和友好型方面天然会号不少。python

首先注册一个帐号,以后能够建立一个仓库git

gitee入门

  Git 全局设置:github

git config --global user.name "张亚飞"
git config --global user.email "1271570224@qq.com"

  建立 git 仓库:shell

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. 

 解决ssh

$ git pull origin master --allow-unrelated-histories
此时会有一个弹窗,提示你修改一个文档的内容,不用管他,按ESC键
再按SHIFT+;  (SHIFT+;用来输入一个冒号)  再输入wq!保存

$ git push -u origin master

# 成功!

添加ssh公钥

 

 本地操做ide

# 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.
相关文章
相关标签/搜索