简体   繁体   中英

How to view repository on GitHub

I have a Java project in my workspace, which I am trying to push to GitHub.

I am a first-time Git user and didn't create a GitHub account yet.

These are the steps I followed.

  1. Initially from the source code folder, I did:

    git --bare init

  2. Again I ran the git init command:

    git init

  3. Created a remote repository:

    git remote add origin ssh://ravi.kiran.com/home/sai/workspace/Sai

  4. Then, I place my local files under version control.

    git add .

  5. git commit -a -m 'initialize repo'

  6. Then I set my global configurations:

    git config --global user.email "ravitest@gmail.com" git config --global user.name "ravikirantest"

  7. Result of git config -l :

     sai@ravikiran:~/workspace/Sai/src$ git config -l user.email=ravitest@gmail.com user.name=ravikirantest core.repositoryformatversion=0 core.filemode=true core.bare=false core.logallrefupdates=true remote.origin.url=ssh://ravi.kiran.com remote.origin.fetch=+refs/heads/*:refs/remotes/origin/* 

Please tell me how can I view my repository in GitHub!

After this, I even created a GitHub account with the above specified email and username, but I am not able to view my files on github.com.

Updated Part

sai@ravikiran:~/workspace/Sai/src$ git push origin master

Username for 'https://github.com': ravikirantest

Password for 'https://ravikirantest@github.com': 

To https://github.com/ravikirantest/Chandrayan.git

 ! [rejected]        master -> master (non-fast-forward)

error: failed to push some refs to 'https://github.com/ravikirantest/Chandrayan.git'

hint: Updates were rejected because the tip of your current branch is behind

hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')

hint: before pushing again.

hint: See the 'Note about fast-forwards' in 'git push --help' for details.

sai@ravikiran:~/workspace/Sai/src$ 

Once you have created your account on GitHub, you will be able to create a new repository from the GitHub web interface.

Once you have created this repository, you will see (detailed in GitHub on your repository page) the URI for it. You can then set this as a remote from your local machine and then push to it.

The procedure on your local machine would be as follows:

git init
git add . 
git commit -m "initial commit"
git remote add origin https://github.com/[your account]/[your repository]
git push origin master 

I think perhaps part of your confusion is not recognizing the difference between Git as a version control system and GitHub which is a service for hosting projects. Git will work completely independently of GitHub. Or you can use GitHub to host your core repository as described above.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM