Skip to content

Instantly share code, notes, and snippets.

@coolicer
Created August 30, 2012 06:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coolicer/3523135 to your computer and use it in GitHub Desktop.
Save coolicer/3523135 to your computer and use it in GitHub Desktop.
Github Help
--------------------------------Github Help--------------------------
0、Linux(windows跳过)
$ cd ~/.ssh //检查计算机ssh密钥
如果没有提示:No such file or directory 说明你不是第一次使用git,执行下面的操作,清理原有ssh密钥
$ ls
config id_rsa id_rsa.pub known_hosts
$ mkdir key_backup
$ cp id_rsa* key_backup
$ rm id_rsa*
---------------------------------------------------------------------
1、获得密钥
ssh-keygen -t rsa -C "xxx@xxx.com"//填写email地址,然后一直“回车”ok (cygwin)
2、登陆github系统。点击右上角的 Account Settings--->SSH Public keys ---> add another public keys
把你本地生成的密钥复制到里面(key文本框中), 点击 add key 就ok了。
3、接着打开git ,测试连接是否成功
$ ssh -T git@github.com
如果提示:Hi defnngj You've successfully authenticated, but GitHub does not provide shell access. 说明你连接成功了
4、设置用户信息
$ git config --global user.name "xxxx"//给自己起个用户名
$ git config --global user.email "xxx@xxx.com"//填写自己的邮箱
---------------------------------------------------------------------
1、创建一个项目(省略)
2、我们需要使用git在本地创建一个相同的项目。
$ makdir ~/hello-world //创建一个项目hello-world
$ cd ~/hello-world //打开这个项目
$ git init //初始化
$ touch README
$ git add README //更新README文件
$ git commit -m 'hello world'//提交更新,并注释信息"hello world"
$ git remote add origin git@github.com:username/hello-world.git //连接远程github项目(SSH)
$ git push -u origin master //将本地项目更新到github项目上去
现在查看github上面的hello world 项目,是不是发现已经将本地中的README文件更新上来了。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment