GITHUB仓库:https://github.com/oleryu/plugins.git
方法与步骤
1. 注册账号、建立一个仓库.
2. 配置本的SSH KEY
生成KEY的命令如下:
$ cd ~/.ssh
$ ssh-keygen -t rsa -C "emailaddress"
如图 github ssh-keygen
在 ~/.ssh 目录下生成两个文件 id_rsa.pub 和 id_rsa,id_rsa.pub 内容需要配置到github.com。
3. 增加ssh key 到github中
如图 github SSH keys
(1、如果你有多台电脑同步代码,建议将title填写为地名,尽量不要使用中文)(2、key框中,请查看home文件夹中的.ssh/.._rsa.pub 将文件里面的文本全部复制到Key框中即可;
4. 同步
$ git clone git@github.com:oleryu/plugins(注:此处的oleryu为你自己的账号名,plugins为你在github中创建的仓库名称)
git clone
5. 上传
$ git add sys
$git commit -m "test"
*** Please tell me who you are.
Run
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
fatal: empty ident name (for <(null)>) not allowed
$git config user.name "mr.yhl@163.com"
$git config user.email "mr.yhl@163.com"
$ git commit -m "test"
[master (root-commit) 4e1bfe0] test
1 file changed, 7 insertions(+)
create mode 100755 sys/test/60_test-metric.sh
$git push
fatal: No configured push destination.
Either specify the URL from the command-line or configure a remote repository using
git remote add
and then push using the remote name
git push
$git remote add plugins https://github.com/oleryu/plugins.git
$git push -u plugins
fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream plugins master
$git push -u plugins master
Username for 'https://github.com': mr.yhl@163.com
Password for 'https://mr.yhl@163.com@github.com':
Counting objects: 5, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (5/5), 544 bytes | 0 bytes/s, done.
Total 5 (delta 0), reused 0 (delta 0)
To https://github.com/oleryu/plugins.git
* [new branch] master -> master
Branch master set up to track remote branch master from plugins.
git clone git@github.com:oleryu/plugins(注:此处的oleryu为你自己的账号名,plugins为你在github中创建的仓库名称)
git remote add plugins git@https://github.com/oleryu/plugins.git
网友评论