Git pushing to a private repo

前端 未结 4 825

I have been working on my local on a web app and I was ask to push it to an empty(only read me file on it) private repo created just for this project. I\'m new to git<

4条回答
  •  有刺的猬
    2020-12-07 12:11

    Let us say 'yourWebApp' is the folder you have your local web app. Change it to the directory

    cd 'yourWebApp'
    

    Init git in the folder

    git init
    

    Now add your github url as a remote

    git remote add origin git://github.com/somename/Web-App.git
    

    Here origin is the short name for your url

    Now pull the read me file from the github repo

     git pull origin master
    

    Now push your web app to the github repository

    git push origin master
    

    Here it is assumed that you are in your master, the default branch

    Here pulling your readme files is necessary to merge the readme file with your local work. If your github repository is empty, you can skip the pull and directly push to your github repository.

    On the other hand, if you want to use clone, there is no need to init as clone automatically sets up git in the directory. clone also sets your remote git url. In that case, your workflow should be

     clone -> push
    

提交回复
热议问题