ssh免密碼,git拉取和上傳代碼,時間同步

ssh免密碼:
建立密鑰
ssh-keygen -t rsa
一直回車node

複製公鑰要指定IP地址
ssh-copy-id -i .ssh/id_rsa.pub root@192.168.254.135
輸入密碼git

測試
ssh root@192.168.254.135服務器

git拉取和上傳代碼:
下載相應的應用目錄及文件
git clone git@node.abc.com:root/test.git
更新數據包(拉取數據)
cd 到相應目錄
git pull
git statusssh

初始化本地git目錄、並添加遠程倉庫
git init
git remote add origin git@node.abc.com:root/test.git
上傳代碼
git status
git add .
git commit -m "x" 刪除
git commit -m "add new feile" 新增
git pull 拉取
git push 推送ide

git commit -m 'update'
git push origin master測試

上傳文件
進入到項目目錄
cd test/
建立須要上傳到GitLab中的目標文件
echo 「test」 > /root/test.sh
將目標文件或者目錄拷貝到項目目錄下
cp /root/test.sh ./
將test.sh文件加入到索引中
git add test.sh
將test.sh提交到本地倉庫
git commit -m 「test.sh」
將文件同步到GitLab服務器上
git push -u origin master 索引

時間同步:
yum -y install ntp
定時任務
每小時同步一次
crontab -ecrontab

  • 1 * /usr/sbin/ntpdate pool.ntp.org >/dev/null 2>&1systemctl start ntpd
相關文章
相關標籤/搜索