新机git简单配置,毕竟不常用,不用每次都查
1、安装git
windows:https://git-scm.com/download/win
ubuntu: apt install git

2、全局配置

git config --global user.name "you_name"
git config --global user.email "your_email@gmail.com"

3、生成ssh-key
ssh-keygen -t rsa -b 4096 -C "your_email@gmail.com"

4、添加ssh到github 以后不用每次都输入邮箱及密码
cat ~/.ssh/id_rsa.pub
把输出的内容拷贝到github上
github 在https://github.com/settings/keys
点击左上角 New SSH key 把刚才的内容复制到下面的框里,点击Add SSH key

5、可以clone你自己的代码 然后修改提交了

如果新创建一个仓库也会有对应的提示:

echo "# test" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/crazypenguincode/test.git
git push -u origin master
git remote add origin https://github.com/xxx/test.git
git push -u origin master

参考:

https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/

  1. Open Terminal.

  2. Paste the text below, substituting in your GitHub email address.

    ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
    

    This creates a new ssh key, using the provided email as a label.

    Generating public/private rsa key pair.
    
  3. When you're prompted to "Enter a file in which to save the key," press Enter. This accepts the default file location.

    Enter a file in which to save the key (/home/you/.ssh/id_rsa): [Press enter]
    
  4. At the prompt, type a secure passphrase. For more information, see "Working with SSH key passphrases".
    Enter passphrase (empty for no passphrase): [Type a passphrase]
    Enter same passphrase again: [Type passphrase again]

https://help.github.com/articles/adding-a-new-ssh-key-to-your-github-account/

Note: DSA keys were deprecated in OpenSSH 7.0. If your operating system uses OpenSSH, you'll need to use an alternate type of key when setting up SSH, such as an RSA key. For instance, if your operating system is MacOS Sierra, you can set up SSH using an RSA key.

  1. Copy the SSH key to your clipboard.

    If your SSH key file has a different name than the example code, modify the filename to match your current setup. When copying your key, don't add any newlines or whitespace.

    $ sudo apt-get install xclip
    # Downloads and installs xclip. If you don't have `apt-get`, you might need to use another installer (like `yum`) $ xclip -sel clip < ~/.ssh/id_rsa.pub
    # Copies the contents of the id_rsa.pub file to your clipboard

    Tip: If xclip isn't working, you can locate the hidden .ssh folder, open the file in your favorite text editor, and copy it to your clipboard.

  2. In the upper-right corner of any page, click your profile photo, then click Settings.

  3. In the user settings sidebar, click SSH and GPG keys.

  4. Click New SSH key or Add SSH key.

  5. In the "Title" field, add a descriptive label for the new key. For example, if you're using a personal Mac, you might call this key "Personal MacBook Air".
  6. Paste your key into the "Key" field.
  7. Click Add SSH key.
  8. If prompted, confirm your GitHub password.

新机git及github sshkey简单配置的更多相关文章

  1. git与github的简单使用教程

    git与github的简单使用教程 一.创建仓库 点击new,进入创建仓库页面 对将要创建的仓库进行一些简单的设置 最后再点击create repository就可以了. 到这我们就创建好了一个仓库. ...

  2. Pycharm中Git、Github的简单使用和配置

    Pycharm中Git.Github的使用 PyCharm本身自带了git,稍微配置一下就可以很好的在图形界面下进行Python项目的版本控制 配置Git 在配置前先新建一个项目,当然也可以打开已有的 ...

  3. git与github安装、配置、pull、push

    操作系统是Ubuntu 16.04 LTS 64bit 1 安装git (1)安装 sudo apt-get install git-core (2)一些全局变量的初始化 在本地建立一个文件夹,然后做 ...

  4. git 与 github 最简单的用法

    今天发现cygwin里已经装了git,所以顺便测试一下git是怎么用的. 大概最简单的用法是这样的: 1.在github创建一个repository.复制右边那个 HTTPS clone URL 2. ...

  5. git和github的简单配合使用

    1.安装git,TortoiseGit. 2.用帐号A登陆github,建立一个版本仓库test1.用默认值创建就可以了. 3.在本机用TortoiseGit克隆仓库test1.直接选https开头的 ...

  6. windows下使用git时生成sshkey和配置

    在windows下如何安装git就不介绍了,我这里主要使用的TortoiseGit,主要记录下在windows上如何通过sshkey链接git 在开始菜单中找到git bash,git bash是gi ...

  7. git 连接github.com 并配置密钥

    传送门:http://www.jianshu.com/p/ff1034ed270e #备份ssh cd ~/.ssh $ ls $ mkdir key_backup //创建备份文件夹 $ cp id ...

  8. 小丁带你走进git世界一-git简单配置

    小丁带你走进git世界一-git简单配置 1.github的简单配置 配置提交代码的信息,例如是谁提交的代码之类的. git config  –global user.name BattleHeaer ...

  9. get最简单直接粗爆git与github教程

    Git是分布式版本控制系统(可以理解为文件管理拓展工具) github一个在线文件托管系统(可以理解为一个在线云盘) 准备工作,在git官网下载git软件件,安装git软件,以windows.为例,下 ...

随机推荐

  1. 从零开始开发一个vue组件打包并发布到npm (把vue组件打包成一个可以直接引用的js文件)

    自己写的组件 有的也挺好的,为了方便以后用自己再用或者给别人用,把组件打包发布到npm是最好不过了,本次打包支持 支持正常的组件调用方式,也支持Vue.use, 也可以直接引用打包好的js文件, 配合 ...

  2. 【Raspberry Pi】crontab 定时任务

    在linux上做定时任务一般用crond 两种方法上文已列,但昨天写的crond命令却一直都没有运行,上网查,有说是环境变量的,也有说是时间问题的,都改过,但还没有效. 今天再次认真读了一遍cront ...

  3. 【转】Android横竖屏重力自适应

    通常我们的应用只会设计成横屏或者竖屏,锁定横屏或竖屏的方法是在manifest.xml文件中设定属性android:screenOrientation为"landscape"或&q ...

  4. android去权限反编译,签名,zipalign优化

    反编译:上工具ApkTool 下载自行搜索google  apktool github cd apktool目录 java -jar apktool_2.0.1.jar d xx.apk 生成xx目录 ...

  5. poj 1322 Chocolate (概率dp)

    ///有c种不同颜色的巧克力.一个个的取.当发现有同样的颜色的就吃掉.去了n个后.到最后还剩m个的概率 ///dp[i][j]表示取了i个还剩j个的概率 ///当m+n为奇时,概率为0 # inclu ...

  6. AndroidManifest.xml文件详解(activity)(四)

    android:multiprocess 这个属性用于设置Activity的实例能否被加载到与启动它的那个组件所在的进程中,如果设置为true,则可以,否则不可以.默认值是false. 通常,一个新的 ...

  7. linux mysql 新增用户 分配权限

    insert into mysql.user(Host,User,Password) values("%","admin",password("adm ...

  8. 解决jsp上传文件,重启tomcat后文件和文件夹自动删除

    吼吼,我遇到的问题是这样的......我写了一个图片上传的方法,上传时,判断没有这个目录就自动建立一个.然后开始上传图片,能成功,能在服务器找到文件夹和相应的文件. 但是,重启项目,或者清理缓存之后, ...

  9. JavaScript-rem字体自适应

    给html标签上添加 id=“FontSize”: 你期望满屏的rem值,如: <html font-size:100px></html> 我的主要内容为1200px,那么我的 ...

  10. 在Web工程中,普通Java类如何读文件

    我们在以前讨论过在Web工程不能采用Java工程原先的读取方式,即创建一个文件流(FileInputStream)并给出一个文件目录(从src开始找一直找到你要读取文件的目录),这种的方式是不可行的. ...