Skip to content

Instantly share code, notes, and snippets.

@zhoufankai
Created January 5, 2017 06:49
Show Gist options
  • Save zhoufankai/1bf8ba1ca5a6e6d28a7c8d5fd86d04ca to your computer and use it in GitHub Desktop.
Save zhoufankai/1bf8ba1ca5a6e6d28a7c8d5fd86d04ca to your computer and use it in GitHub Desktop.
How to romote github's repository.
1.先保证你有github的账号,和你本地安装好了git, git --help如果成功的话就算已经安装好了。
2.设置你是ssh key
进入到~apple/.ssh 目录下(如果没有创建一个), 执行ssh-keygen -t rsa命令, 期间会确认生成的文件名和提示输入密码的操作(你可以按照你自己设置),
最后会有2个文件生成, 分别是id_rsa,id_rsa.pub,打开github->setting下的SSH and GPG keys,新增一个SSH keys,把你的id_rsa.pub里的key添加到对应的空格中。
3.本利连接上远端地址
git remote origin add git@github.com
远端的地址你可以在仓库资源里的clone or download选项里面拷贝。
4.初始化你的git仓库,并进行push到远端 命令如下
git init
git add ./
git commit -m 'your comment'
git push
如果在push过程中出现
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'git@github.com:zhoufankai/DataAnalysis.git'表示你原仓库有了不同的资源,提交被拒绝,这个时候你可以重新push再merge一下(推荐),或者进行强制push。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment