Git是一个功能强大的分布式版本控制系统,最初用来作Linux内核代码管理的。
第一次接触到github是关于一个报道:在2013年1月15日晚间,全球最大的社交编程及代码托管网站GitHub突然疑似遭遇DDOS攻击,访问大幅放缓,该网站管理员经过日志查询,发现是来自12306的抢票插件用户洪水般的访问导致GitHub出现问题。
进入正题,github的第一次使用大概分以下步骤:
(环境:readhat 5, 提前装好git。若没有安装,用“yum install git-core”命令安装,解决各种依赖问题,很方便。)
1. 申请github账户,并创建repository
2. 本地生成密钥对
3. 设置github上的公钥
4. 创建本地项目
- 申请github账户,并创建repository
在https://github.com上申请github账户,我的账户名是toughhou,并创建了名为etl的repository。
- 本地生成密钥对
Git 服务器通常使用 SSH 公钥来进行授权。SSH 公钥默认储存在账户的主目录下的 ~/.ssh 目录。系统中的每个用户都必须提供一个公钥用于授权,没有的话就要生成一个。我没有,这里创建一个。步骤如下:
[root@ora11g ~]# mkdir .ssh
[root@ora11g ~]# cd .ssh/
//用ssh-keygen命令来生成密钥对,passphrase我们输入或不输入都行。
[root@ora11g .ssh]# ssh-keygen -t rsa -C "toughhou@126.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
03:73:b8:13:4c:cb:63:d0:c3:0b:5d:03:7d:0f:7e:18 toughhou@126.com
[root@ora11g .ssh]# ll
total 8
-rw------- 1 root root 1675 May 5 23:25 id_rsa
-rw-r--r-- 1 root root 398 May 5 23:25 id_rsa.pub
id_rsa.pub就是公钥文件,id_rsa就是密钥。
- 设置github上的公钥
步骤如下:
a. 登陆github后 -> "Account Setting" -> "SSH Keys"
b. "Add SSH Key"
c. Title随便填写一个,Key那里我们把把id_rsa.pub里的内容拷贝进去。
//好了之后用以下命令测试,若显示信息如下,则说明设置成功了。
[root@ora11g etl]# ssh -T git@github.com
Hi toughhou! You've successfully authenticated, but GitHub does not provide shell access.
- 创建本地项目
[root@ora11g ~]# mkdir etl
[root@ora11g ~]# cd etl/
//git初始化
[root@ora11g etl]# git init
Initialized empty Git repository in /root/etl/.git/
[root@ora11g etl]# touch readme.txt
[root@ora11g etl]# git add readme.txt
//使用git协议定义远程服务器别名origin
[root@ora11g etl]# git remote add origin git@github.com:toughhou/etl.git
此处需要注意:
git默认使用https协议,每次pull或push都要输入密码,比较麻烦。而且因为操作系统版本及一些库文件不全,设置起来很繁琐。
我们这里使用git协议,然后使用ssh密钥。这样可以省去每次都输密码。
用https协议方式定义远程服务器别名:git remote add origin https://github.com/toughhou/etl.git
//查看你当前的remote url
[root@ora11g etl]# git remote -v
origin https://github.com/toughhou/etl.git (fetch)
origin https://github.com/toughhou/etl.git (push)
//commit
[root@ora11g etl]# git commit -m "First commit!!"
git commit -m "First commitgit remote -v"
[master (root-commit) 4bd96e9] First commitgit remote -v
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 readme.txt
//push
[root@ora11g etl]# git push -u origin master
Counting objects: 3, done.
Writing objects: 100% (3/3), 215 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
To git@github.com:toughhou/etl.git
* [new branch] master -> master
Branch master set up to track remote branch master from origin.
push完成之后,登陆github (https://github.com/toughhou/etl)查看,文件已经同步上去。
测试完成。
//文中提到的如果用的是https协议的话,效果如下。push时需要输入密码。
[root@ora11g etl]# git remote add origin9 https://github.com/toughhou/etl.git
[root@ora11g etl]# git push -u origin9 master
Username for 'https://github.com': toughhou
Password for 'https://toughhou@github.com':
Branch master set up to track remote branch master from origin9.
Everything up-to-date
用https协议的话,可能会碰到一些问题。这里把我碰到的问题及解决方式记录如下:
[root@ora11g etl]# git push -u origin master
error: SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed while accessing https://github.com/toughhou/etl.git/info/refs?service=git-receive-pack
fatal: HTTP request failed[root@ora11g etl]# curl http://curl.haxx.se/ca/cacert.pem -o /etc/pki/tls/certs/ca-bundle.crt
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 244k 100 244k 0 0 7785 0 0:00:32 0:00:32 --:--:-- 2690
[root@ora11g etl]# git push -u origin master(gnome-ssh-askpass:14850): Gtk-WARNING **: cannot open display:
error: unable to read askpass response from '/usr/libexec/openssh/gnome-ssh-askpass'
Username for 'https://github.com': toughhou(gnome-ssh-askpass:14856): Gtk-WARNING **: cannot open display:
error: unable to read askpass response from '/usr/libexec/openssh/gnome-ssh-askpass'
Password for 'https://toughhou@github.com':
Branch master set up to track remote branch master from origin.
Everything up-to-date
[root@ora11g etl]# echo 'unset SSH_ASKPASS' >> ~/.bashrc && source ~/.bashrc
[root@ora11g etl]# git push -u origin master
Username for 'https://github.com': toughhou
Password for 'https://toughhou@github.com':
Branch master set up to track remote branch master from origin.
Everything up-to-date
From: http://www.360doc.com/content/15/0413/15/10648726_462911761.shtml
相关推荐
在macOS您应该仅在首次启动和完整程序关闭后才修补GitKraken ! 要求 Node.js v12 LTS 或更高版本 yarn 快速开始 git clone https://github.com/5cr1pt/GitCracken.git cd GitCracken/GitCracken/ yarn install ...
GitKraken时间轴 一切始于2014年。您之前曾听过这个故事...GitKraken现在为Git新手和专业人士在Mac,Windows和Linux上提供一致的体验。并使Git操作不仅高效,高效,而且易于理解,直观,甚至可能只是一点点…… 有趣!
1.5 初次运行 Git 前的配置 . . . . . . . . . . . . . . . . . . . . . . . 9 1.5.1 用户信息 . . . . . . . . . . . . . . . . . . . . . . . . . . 9 1.5.2 文本编辑器 . . . . . . . . . . . . . . . . . . . . ...
1.5 初次运行Git 前的配置. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1.5.1 用户信息. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1.5.2 文本编辑器. . . . . . ...
将首次安装程序置于GNU + Linux系统的简单模式下! 从第一天开始就可以使用该系统。 这些脚本会自动安装许多用户期望的程序和配置设置,并通知您所需的任何手动步骤。 我会定期为我自己和我帮助的人更新和使用这些...
git clone https://github.com/marguerite/linux-bing-wallpaper cd linux-bing-wallpaper export GO111MODULE=ON go mod download go mod vendor go build 将生成的linux-bing-wallpaper复制到某个位置(例如,/ ...
(您也可以使用VNC来) cd ~ git clone https://github.com/dianariyanto/virtual-display-linux.git cd virtual-display-linux sudo chmod +x vdl-monitor 更改您自己的分辨率设置vdl-monitor.conf ./vdl-monitor ...
首先,我们介绍如何安装交叉编译开发工具Embedded Linux Development Kit(ELDK),这个开发套件你很有可能会用到——至少当你在标准的x86 PC上使用Linux或者Sun Solaris系统作为开发环境的时候,你会需要它的。...
Etckeeper-ng是一个bash脚本,它使用git和rsync awk sed并找到创建/ etc linux目录的备份目录。 易于配置。 默认配置适用于大多数设备。 只要确保您已安装git rsync和所有其他要求即可。 首次使用etckeeper-ng时,请...
sudo apt-get/apt install git此命令将安装Git及其组件,以在Debian上Linux上正确使用git。 sudo yum install git为Fedora sudo yum install git Git。 git对于MAC,首次提示您安装它。配置Git git config --global...
oracle-12.2-vagrant 一个vagrant框,它使用Vagrant,最新的Oracle Linux 7框和Shell脚本自动置备Oracle Database 12c第2版。先决条件安装 安装入门克隆此存储库git clone ...
首次启动,使用Kubuntu 20.04.2 LTS 安装 # install git sudo apt update sudo apt install git curl wget --no-install-recommends # git clone git clone https://github.com/sudosubin/setup-script.git bash ...
使用git命令行: Linux: git本机安装在linux中 Windows: Windows用户可以从下载并安装git命令行 首次公关的步骤: 按照给定的视频学习如何进行首次公关! 使用的命令 1)克隆回购 git clone Repo_URL 2)...
您需要使用git lfs克隆软件包 首次设置时,启用sudo ,NetworkManager并连接到互联网 然后跑 ./slackware/configure.sh ./slackware/install.sh 要安装大WaSP: 首先克隆您的仓库 cd slackware/packages/bumblebee/ ...
配置 ovcs 以供首次使用。 支持以下设置: oracle-driver 设置 Oracle JDBC 库的位置 示例:(实际路径可能有所不同) 在 Windows 上: ovcs config oracle-driver c:\oracle\app\oracle\product\11.2.0\server\...
请转到最新版本页面 从SnapStore sudo snap install walc 使用WALC-预先构建的AppImage 在〜/ .local / bin中下载最新的AppImage,这是AppImages的推荐位置使用chmod +x ~/.local/bin/WALC.AppImage使其可执行首次...
对于初级用户来说,在 Linux 下编译配置 libnfc 是个不小的挑战 libnfc 对于 ACR-122U 需要 在 OS X 下,即使没有插入设备,pcscd 也会占用额外的系统资源 需要一个更洁净的环境? 安装 首先,你需要有 及 。Vagrant...
配置管理器一组不错的脚本,用于在多个Linux用户帐户和系统之间在VCS下管理和共享用户配置文件。正在安装通过克隆存储库并运行安装脚本,可以轻松完成安装。 git clone ...
本文基于初次或再次尝试部署.Net Core应用到Linux服务器上,我尝试后自我总结的经验一个简单的Demo,尝试部署在Linux服务器上和跨服务器访问数据库。 一、环境介绍 1、本地使用Visual Studio 2017开发,使用的....
一个基于的LNMP环境,并利用 + 提供gui管理(目前只处理了window环境和mac环境,后续支持linux) 其中gui界面通过+++实现。 使用 npm打开 git clone https://github.com/aogg/docker_lnmp.git cd electron npm ...