Skip to content

github configuration

ZefengYu edited this page Apr 7, 2016 · 2 revisions

@(SwifterTips)[github,git,config] how to config github

When you connect to a GitHub repository from Git, you'll need to authenticate with GitHub using either HTTPS or SSH.

#####Connecting over HTTPS (recommended)

If you clone with HTTPS, you can cache your GitHub password in Git using a credential helper.

#####Connecting over SSH

If you clone with SSH, you must generate SSH keys on each computer you use to push or pull from GitHub.

git config --global user.name 'zeffon'
git config --global user.email 'zephoony#gmail.com'
git config --global
ssh-keygen -t rsa -C "zephoony#gmail.com"
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
cat ~/.ssh/id_rsa.pub | pbcopy

(1) add the new respository (2) add ssh key in the SSH keys of your github settings title: write in your own content:ssh-rsa ,which we can get in this command line cat ~/.ssh/id_rsa.pub | pbcopy

ssh-rsa 

connect the github

ssh -T [email protected]
git remote -v

建新的git仓库

$ mkdir git_repo
$ cd git_repo
$ git init
$ echo "test" > README.mkd
$ git add README.mkd
$ git commit -m "add README.mkd file"
$ git remote add origin [email protected]:username/test.git
$ git push -u origin master

使用已存在的git仓库

$ cd git_repo
$ git remote add origin [email protected]:username/test.git
$ git push -u origin master

参考链接

1.how-to-configure-git-github-on-your-mac 2.Customizing-Git-Git-Configuration 3.git的相关配置 4.Generating a new SSH key and adding it to the ssh-agent 5.github help