现在的位置: 首页 > 综合 > 正文

ssh 建立github验证

2017年10月23日 ⁄ 综合 ⁄ 共 1239字 ⁄ 字号 评论关闭

建立ssh无验证连接
Check for SSH keys、
cd ~/.ssh
ls
Check the directory listing to see if you have a file named either id_rsa.pub or id_dsa.pub
检查有无产生过的key,一台机器只能创建一个。如果重新创建则前一个会被覆盖。
Generate a new SSH key
ssh-keygen -t rsa -C "your_email@example.com"# Creates a new ssh key, using the provided email as a label
这里的邮箱只是一个标识你可以随便取。对产生密钥没有影响。
增加密钥到远程仓库
~/.ssh/id_rsa.pub将这里的内容增加到远程ssh仓库中。

Download and Install Git
sudo apt-get install git

configure your settings
git config --global user.name "Your Name Here"# Sets the default name for git to use when you commit
git config --global user.email "your_email@example.com"# Sets the default email for git to use when you commit

创建一个仓库在github或者gitlab等网站上:
cd进入项目的根目录下
git init# Sets up the necessary Git files
git add .#adding it to the list of files to be committed
git commit -m 'first commit'# Commits your files, adding the message "first commit"

Push your commit
git remote add origin https://github.com/username/Hello-World.git# Creates a remote named "origin" pointing at your GitHub repository
git push origin master# Sends your commits in the "master" branch to GitHub

fork project#自己想帮助别人的项目,或想用别人的项目作为自己的起点。
先要ssh建立连接,见上面
然后git clone https://github.com/username/Spoon-Knife.git#不管是github还是gitlab都可以。git通用
Create branch with your feature
git checkout -b $feature_name
Write code. Commit changes
git commit -am "My feature is ready"
Push your branch to GitLab
git push origin $feature_name

抱歉!评论已关闭.