how to code commit on github using MINGW32? - github

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

Related

Getting master instead of main

When I use create-react-app and cd into the directory it already shows me (master) when I haven't even initialized git. When I try to do git init and set remote origin it still stays the same and my repository isn't connected. What should I do?
Create react app initialises git automatically, and adds a .gitignore
Try to solve it by this example
echo "# qqq" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin git#github.com:{username}/{repository}.git
git push -u origin main

Github code retrieval returns sha hash instead of actual code

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.

Why I'm having problems pushing my first repo?

I'm trying to push my first repo to github but I got this error
git branch -M main
fatal: Invalid branch name: 'HEAD'
Could someone help me to fix the problem
git branch is a local command which does not push anything.
To avoid any issue, the easiest approach is:
git clone https://github.com/<me>/<myRepo>
cd <myRepo>
# report the work you did in your previous repo
git add .
git commit -m "First commit"
git push -u origin main

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

Github - How to update my own repository?

I have a repository in my Github, and I cloned it on my desktop. Then I did some work in the folder. How do I commit those changes to my repository?
below code is right, but don't forget to add remote address to key "origin".
git remote add origin <YOUR_REPOSITORY_PATH>
git add .
git commit -m 'some change'
git push -u origin master
-u – sets repo branch as defaults, so then you can push, just git push
May
git add .
git commit -m "my changes"
git push origin master