Gitee(码云)基本使用

概要

使用GitHub时,经常遇到速度慢甚至无法连接的情况(),而且GitHub创建私有仓库是需要收费的,有以上需求的可以考虑使用国内的Git托管服务码云

相比于GitHub,码云有以下优势:

  • 首先,在语言的使用上,当然中文交流更畅快、更有效率;
  • 其次,国内 IT 行业有自己的特点,天然决定了对开源软件的需求也有自己的特点,比如小程序这个东西,只有国内有,做个开源的小程序托管在码云比 GitHub 明显更有优势,因为关注着都是国内的开发者;
  • 然后,开源不仅仅是大项目,像 OpenStack、Tensorflow 这样的大厂大作,确实有 GitHub 就够了,但是这样的大型项目毕竟不是普遍情况。现在编程越来越普及,每个人都可以参与和贡献开源项目,去做一些有意思的东西分享出来,那么从受众、交流便利度、访问速度等方面,码云都有优势

配置公钥

mac下运行
$ ssh-keygen -t rsa -C "XXXXX"

ssh-key

将生成的公钥内容按照如下方式配置到个人码云上

add-sshkey

sshkey

新建项目

newproj

配置远程库关联

首先执行$ git remote -v查看本地关联的远程库,如果没有任何关联,可以执行$ git remote add gitee git@gitee.com:trymesoft/myblog.git添加远程库。
如果存在说明当前目录之前关联过Git远程库,可以在一个新的目录执行$ git init初始化一个新的本地仓库,也可以执行$ git remove rm "XXX"删除, 还可以再添加一个不重名的远程库。
提交的时候指定push,例:$ git push gitee master,这样一来,我们的本地库就可以同时与多个远程库互相同步:

push

参考:地址1 地址2


2018-05-06更新
有的时候,我们按上述过程配置完成后,执行$ ssh -T v git@gitee.com时,会出现以下错误:

OpenSSH_7.4p1, LibreSSL 2.5.0
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to gitee.com [120.55.226.24] port 22.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /Users/wangyx/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/wangyx/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/wangyx/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/wangyx/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/wangyx/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/wangyx/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/wangyx/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/wangyx/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.4
debug1: Remote protocol version 2.0, remote software version OSChina.NET
debug1: no match: OSChina.NET
debug1: Authenticating to gitee.com:22 as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256@libssh.org
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: aes128-ctr MAC: hmac-sha2-256 compression: none
debug1: kex: client->server cipher: aes128-ctr MAC: hmac-sha2-256 compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:FQGC9Kn/eye1W8icdBgrQp+KkGYoFgbVr17bmjey0Wc
debug1: Host 'gitee.com' is known and matches the ECDSA host key.
debug1: Found key in /Users/wangyx/.ssh/known_hosts:1
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /Users/wangyx/.ssh/id_rsa
debug1: Trying private key: /Users/wangyx/.ssh/id_dsa
debug1: Trying private key: /Users/wangyx/.ssh/id_ecdsa
debug1: Trying private key: /Users/wangyx/.ssh/id_ed25519
debug1: No more authentication methods to try.
Permission denied (publickey).

解决方法 执行 ssh-add 文件绝对路径即可

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 136,058评论 19 139
  • 用到的组件 1、通过CocoaPods安装 2、第三方类库安装 3、第三方服务 友盟社会化分享组件 友盟用户反馈 ...
    SunnyLeong阅读 14,973评论 1 180
  • 怀着一颗安静的心,我慢慢看完《看见》,在这期间我的心情忽上忽下,我不知道别人看了会是什么样的想法,但此时此刻我只能...
    goodbyed阅读 4,158评论 0 1
  • (创作所需,文章涉及人物皆是化名,呼吁大家,远离酒瘾的伤害,重建美好人生) 《停杯罢饮》往期目录: 1 程金华停杯...
    彧婠九尾猫阅读 4,770评论 3 11
  • 不知道有多少人,有过这样的困扰. 楼上的邻居走路声音很大,你虽然生气却不想去交涉,因为害怕引发不必要的冲突;图书馆...
    坤坤的偏见阅读 3,465评论 0 1

友情链接更多精彩内容