How can I upload fresh code at github?

前端 未结 7 1400
孤街浪徒
孤街浪徒 2021-01-29 19:03

I have a directory with all my coding projects.

I want to upload (correct terminology?) it to GitHub using the command line.

I have already looked at Old questi

7条回答
  •  耶瑟儿~
    2021-01-29 19:24

    Just to add on to the other answers, before i knew my way around git, i was looking for some way to upload existing code to a new github (or other git) repo. Here's the brief that would save time for newbs:-

    Assuming you have your NEW empty github or other git repo ready:-

    cd "/your/repo/dir"
    git clone https://github.com/user_AKA_you/repoName # (creates /your/repo/dir/repoName)
    cp "/all/your/existing/code/*" "/your/repo/dir/repoName/"
    git add -A
    git commit -m "initial commit"
    git push origin master
    

    Alternatively if you have an existing local git repo

    cd "/your/repo/dir/repoName"
    #add your remote github or other git repo
    git remote set-url origin https://github.com/user_AKA_you/your_repoName
    git commit -m "new origin commit"
    git push origin master
    

提交回复
热议问题