After using git to locally track a project, how can I add it to GitHub?

后端 未结 3 1372
难免孤独
难免孤独 2021-01-30 20:58

After using git to locally track a project, how can I add it to GitHub?

相关标签:
3条回答
  • 2021-01-30 21:43

    Here you will find the steps about how to create a repository and how to push it on Github: http://programertools.blogspot.com/2014/04/how-to-use-github.html

    0 讨论(0)
  • 2021-01-30 21:47

    GitHub gives you instructions after you've created the repository online.

    cd to the directory with the local repository

    git remote add origin whatever-address-my-repository is.git to set the remote

    then make a commit, and push to the master branch.

    git push -u origin master

    https://help.github.com/articles/create-a-repo

    0 讨论(0)
  • 2021-01-30 22:05

    1.Create a README.md in your local repo (for GitHub -*optional)

    2.git remote add origin <your_URL_for_github_repo.git>

    (You can verify you have origin by entering git remote -v. You could see <URL>.git as the origin).

    3.Make a commit by git commit -a -m "<a message>"

    (Important! Only committed files will be pushed to Github)

    4.Now push to GitHub by git push -u origin master (If you pushing the master branch).

    You will be needing passwords every time you push (If you cloned using https:).For get rid of that ;

    In Terminal, enter the following:

    git config --global credential.helper cache
    # Set git to use the credential memory cache
    

    To change the default password cache timeout, enter the following:

    git config --global credential.helper 'cache --timeout=3600'
    # Set the cache to timeout after 1 hour (setting is in seconds)
    
    0 讨论(0)
提交回复
热议问题