Github code retrieval returns sha hash instead of actual code - github

I'm uploading my code to github, but when I navigate to it in the web browser I can't actually read the code unless I click on "view raw" or "download."
If I make code changes and upload them:
git add *
git commit -m "test"
Git push origin master
and then fetch them again:
git fetch --all
git reset --hard master
My code is replaced with this:
version https://git-lfs.github.com/spec/v1
oid sha256:01fb22a63967e11c50ac23ecb33144bebc7d2a9f011e19cdd0681cd2873aff02
size 12550
Any idea whats going on or how to fix it?

I suggest you delete your repo on your GitHub, and do it all over again using this workflow.
1 Add + commit, which you did correct:
git add *
git commit -m "test"
2 Create a remote branch:
git push origin Remote-Branch-Name
3 Push to remote branch:
git push -u origin Remote-Branch-Name
This should upload you code as actual code, and not SHA.

Related

How to make pull request?

I am new in git and in nodejs. My question is I build a project and uploaded it on github in main branch. But members are asking to to give pull request. How can I make a pull request please tell me full procedure with commands if possible thankyou.
I uploaded on git like this
Git init
Git add .
Git commit -m"initial commit"
Git git add origin main githublink(ssh)
Git push -u origin main
After this my project is uploaded successfully
Now how can I make a pull request
first you need to checkout from the main branch by git checkout
then you develop and code in that branch
next you commit and push that branch on github repo
git commit -m"initial commit"
git add origin <your_branch> githublink(ssh)
git push -u origin <your_branch>
finally you access the github page and your new branch. create a pull request into the main branch. then share that pr to your colleagues.
for example the last step:

Files not appearing on github

I am new to web development and have just created my first project. I created a new repository on github and then did the following on git bash:
Moved to the working directory for my project
Initialized the git repository using git init
Added my files using git add .
Committed the files using git commit -m 'my message'
Added the github URL under code. on github by using git remote add origin 'my_url_name'
Pushed the code to github using git push -u origin master (also entered my passphrase correctly as I am using SSH)
Git Bash confirmed the upload and then nothing appeared on my repository on github
Note. I did get a message at the top of the repository saying "master had recent pushes x minutes ago: with a button that says "Compare & pull request" though the page just shows a message "There isn't anything to compare."
Am I missing a step?
The branch selected in your git is master. But in GitHub is main. To display your codes in GitHub, you need to change the Git branch to main.
First delete previous repository in Github and create a new , then act according to the following codes in the git :
git branch main
git checkout main
git merge master
git branch -M main
git remote set-url origin https://github.com/masoud8911/example.git
git push -u origin main
It could be that your local branch name is main not master. You can check this locally with:
git branch.
try instead:
git push -u origin main
Make sure you are selecting the correct branch on github. At the top of the repository, on the same line as "Go to file" "Add file" and "Code" on the far left is a button to select the branch. Make sure the branch is the same as the branch used as origin when the push was declared on Git Bash.

Pushing folder into github

I was trying to push the folder on my computer to GitHub. So I created a GitHub repository, and use git bash command line. I didn't push the folder successfully on my first try. Then, I deleted the old GitHub repository and created a new one, and tried using the git bash command line to push code again. However, it shows nothing to commit.
Here is an image to better help understand
According to the image, I understand that you have made a commit but your commit was empty and you did not track any file with git beforehand. You typically want to track the files you want to commit. So in this case you could use git add before committing:
git add .
This should track all files in the current folder after which you could commit and push them:
git commit -m "Some message"
git push
When you create a new repository on git, it shows you how to properly upload data
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/youracc/your.git
git push -u origin main

How to delete GitHub blame history?

I'd like to delete the GitHub blame history that GitHub shows (tracking all changes made)
I am aware of how to how to roll back changes, but I am not trying to roll back any changes I have made, I am simply trying to delete this history of the changes.
Obviously, I do own the repository that I will be operating on (and am the sole owner)
If this is for all files of your GitHub repository, the simplest way would be to:
initialize a new local repository
add files from the original repo
add as remote the original repo GitHub URL
force push
That is:
git clone https://github.com/me/myrepo
git init myrepo2
cd repo2
git --work-tree=../myrepo add .
git checkout # -- .
git commit -m "Import myrepo"
git remote add origin https://github.com/me/myrepo
git push --force -u origin master

how to code commit on github using MINGW32?

i created a repositories on github.
now i want to put my some code there can anybody tell me how to do this and how to commit code.
i tried using this lines
touch README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/Dany001/myrepo.git
git push -u origin master
please short out my problem
Thanks