设置用户,邮箱,通gitlab上一致
[hutx@space1 ~]$ git config --global user.name hutx
[hutx@space1 ~]$ git config --global user.email hutx@ucweb.com
生成密钥,私钥,并上传到gitlab你的用户下
本地.ssh权限,
chmod 755 *
chmod 600 id_dsa
[hutx@space1 .ssh]$ ls -l
total 16
-rwxr-xr-x 1 hutx hutx 45 Sep 14 11:41 config
-rw------- 1 hutx hutx 672 Aug 8 22:48 id_dsa
-rwxr-xr-x 1 hutx hutx 599 Aug 8 22:48 id_dsa.pub
-rw-r--r-- 1 hutx hutx 402 Sep 14 12:11 known_hosts
config文件需要自己建立,并配置
Host space1
HostName 10.16.131.229
Port 9922
克隆
[hutx@space1 .ssh]$ cd .. [hutx@space1 ~]$ git clone git@space1:ucpoint-act/offline-scripts.git Cloning into 'offline-scripts'... remote: Counting objects: 46, done. remote: Compressing objects: 100% (38/38), done. remote: Total 46 (delta 20), reused 0 (delta 0) Receiving objects: 100% (46/46), 6.38 KiB | 0 bytes/s, done. Resolving deltas: 100% (20/20), done. Checking connectivity... done.
检查分支
[hutx@space1 offline-scripts]$ git branch
* master
检查status
[hutx@space1 offline-scripts]$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
修改并上传
[hutx@space1 offline-scripts]$ cd scripts/ [hutx@space1 scripts]$ ls offline2mysqlnew.py offline2mysql.py [hutx@space1 scripts]$ vi offline2mysqlnew.py [hutx@space1 scripts]$ git add Nothing specified, nothing added. Maybe you wanted to say 'git add .'? [hutx@space1 scripts]$ git add . [hutx@space1 scripts]$ git status On branch master Your branch is up-to-date with 'origin/master'. Changes to be committed: (use "git reset HEAD <file>..." to unstage) modified: offline2mysqlnew.py [hutx@space1 scripts]$ git commit -m "formal enviroment True modify to true" [master 78cd0a7] formal enviroment True modify to true 1 file changed, 2 insertions(+), 2 deletions(-) [hutx@space1 scripts]$ ls offline2mysqlnew.py offline2mysql.py [hutx@space1 scripts]$ cd .. [hutx@space1 offline-scripts]$ cd ls -bash: cd: ls: No such file or directory [hutx@space1 offline-scripts]$ ls scripts [hutx@space1 offline-scripts]$ cd .git [hutx@space1 .git]$ ls branches COMMIT_EDITMSG config description HEAD hooks index info logs objects packed-refs refs [hutx@space1 .git]$ cd .. [hutx@space1 offline-scripts]$ ls scripts [hutx@space1 offline-scripts]$ cd scripts/ [hutx@space1 scripts]$ git push origin master Counting objects: 4, done. Delta compression using up to 16 threads. Compressing objects: 100% (4/4), done. Writing objects: 100% (4/4), 353 bytes | 0 bytes/s, done. Total 4 (delta 3), reused 0 (delta 0) To git@space1:ucpoint-act/offline-scripts.git 90e36a9..78cd0a7 master -> master
因为是git clone下来的
直接使用git push即可