首页 > 技术文章 > github 新建库,提交命令

xiaoniu-666
原文

默认使用rsa算法,你也可以用比较详细的指令,如

ssh-keygen -t rsa -b 1024 -f yourkeyname -C "备注[email/...]"
参数解释
-b 采用长度1024bit的密钥对,b=bits,最长4096,不过没啥必要
-t rsa 采用rsa加密方式,t=type
-f 生成文件名,f=output_keyfiles
-C 备注,C=comment

更多参数可运行 man ssh-keygen

 

Command line instructions

You can also upload existing files from your computer using the instructions below.

Git global setup
git config --global user.name "xxx"
git config --global user.email "xxx@gmail.com"
Create a new repository
git clone git@gitlab.com:xxx/test.git
cd test
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master
Push an existing folder
cd existing_folder
git init
git remote add origin git@gitlab.com:xxx/test.git
git add .
git commit -m "Initial commit"
git push -u origin master
Push an existing Git repository
cd existing_repo
git remote rename origin old-origin
git remote add origin git@gitlab.com:xxx/test.git
git push -u origin --all
git push -u origin --tags
 

git之https或http方式设置记住用户名和密码的方法


https方式每次都要输入密码,按照如下设置即可输入一次就不用再手输入密码的困扰而且又享受https带来的极速

设置记住密码(默认15分钟):

git config --global credential.helper cache

如果想自己设置时间,可以这样做:

git config credential.helper 'cache --timeout=3600'

这样就设置一个小时之后失效

长期存储密码:

git config --global credential.helper store

 

推荐阅读