Dummy questions about setting up git on amazon cloud ec2

前端 未结 3 1019
北恋
北恋 2021-02-03 11:59

first of all, apologize for dummy questions that I might throw here. It would be nice if you could point the directions where should I go from here.

I\'m totally new to

3条回答
  •  不要未来只要你来
    2021-02-03 12:47

    i created a GitHub gist with all the details hope it helps https://gist.github.com/eslam-mahmoud/35777e4382599438023abefc9786a382

    //add your EC2 .pem file to ssh kys
    ssh-add ~/aws/mypemfile.pem 
    
    //create bare repo on AWS EC2 webserver and deploy on demand
    mkdir ~/git/the_project 
    cd ~/git/the_project
    git init --bare
    
    //create local repo and track remote one
    cd ~/git/the_project 
    git init
    git add . 
    git commit -m "Initial git commit message" 
    git remote add aws ubuntu@1.1.1.1:~/git/the_project 
    git config --global remote.origin.receivepack "git receive-pack" 
    git push aws master
    //create tag
    git tag -a v0.1 -m "my version 0.1"
    //push tags
    git push aws --tags
    
    //Or you have one so you push your updates 
    git remote add aws ubuntu@1.1.1.1:~/git/the_project 
    git config --global remote.origin.receivepack "git receive-pack" 
    git push aws master
    //create tag
    git tag -a v0.1 -m "my version 0.1"
    //push tags
    git push aws --tags
    
    //on server create another local repo that track the bare one to deploy
    git clone ~/git/the_project
    cd ./the_project
    //checkout tag
    git checkout v0.1
    //install clear cache ...
    npm install
    

提交回复
热议问题