How do I find the private git repository URL? - github

Where in my repository under the code it's not showing any URL

It is usually git#github.com:<username>/<reponame>.git
In command line you have to go to your project directory and type:
git init
This is going to initialise Git in you project directory
To add your project to Git you have to add a commit
git add .
followed by your commit message
git commit -m "<message>"
message can be anything you want to write to identify that commit... You can write First commit for example
After that you will want to set your origin url
git remote add origin git#github.com:<organisation_name>/<reponame>.git
The organisation_name is most probably the account that created the repo
With your origin set you can push it to Git:
git push origin master

Related

Not able to add remote repository

I want to push changes from my local repository to my github repo. I start with the commands giving from github quickstep:
git init
git add .
git commit -m "first commit"
and then
$ git add origin https://github.com/Svein-Tore/forrigling.git
fatal: pathspec 'origin' did not match any files
Any suggestions to what can be wrong?
You've to use git remote add origin https://github.com/Svein-Tore/forrigling.git
When you use git add origin, it tries to add the file 'origin'

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.

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.

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

Push an existing repository when creating a new repository always fail?

So every time I try to create a new repository and follow the Github instruction here.
…or push an existing repository from the command line
git remote add origin
https://github.com/menghaohsu/JavaAkkaCountWordInDirectory.git
git push -u origin master
It doesn't push the file in JavaAkkaCountWordInDirectory to Github but push repository. Can anyone help me with this?
Let me give you a few steps over here.
I assume you created your repo via GitHub.com web interface.
Locally you should have done all of the following steps prior to pushing the files to the remote.
git init --> This will initialize your local repo
git remote add origin {remote address}
git add {filename here | . } --> With this you add the file(s) to the staging area
git commit --> This command commits your changes (You have to add a message)
git -u push origin master
That should do the trick