生成新的SSH密钥对
ssh-keygen -o -t rsa -b 4096 -C "email@domain.com"
将SSH密钥添加到您的GitLab账户
Copy your public SSH key to the clipboard and paste it into your user account > SSH Keys
要进行身份验证,您需要在~/.ssh/config中设置以下内容的配置;
Host domain.com
Hostname domain.com
User git
Port 30001
Preferredauthentications publickey
RequestTTY no
IdentityFile ~/.ssh/id_rsa
您可以使用以下命令; 这些命令中提到了常见变量,请替换相关值。
创建新存储库
git clone ssh://git@domain.com:port-number/user-name/project-name.git
cd project-name
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master
推送一个已存在的文件夹
cd existing_folder
git init
git remote add origin ssh://git@domain.com:port-number/user-name/project-name.git
git add .
git commit -m "Initial commit"
git push -u origin master
推送现有的 Git 仓库
cd existing_repo
git remote rename origin old-origin
git remote add origin ssh://git@domain.com:port-number/user-name/project-name.git
git push -u origin --all
git push -u origin --tags
克隆代码库:
git clone https://git@domain.com:port-number/user-name/project-name.git
git config core.sharedRepository true
命令吗?并且像这个链接http://serverfault.com/a/27040/783中所示,使用chmod命令。 - VonC~/.ssh/
(id_rsa.pub
,id_rsa
) 中。 - VonC