git fetch upstream master not working, what is going wrong? - bash

So I'm wondering if there is a problem with the upstream master?
I'm not sure if this error happens when everything is updated already or if it's something different.
I have added upstream link with no problem, using
$ git remote add upstream https://github.com/udacity/course-collboration-travel-plans.git
just want to sync with the master now

Of course, your Repository URL: https://github.com/udacity/course-collboration-travel-plans.git is giving 404. There is no repository at your added remote.
Particularly I am seeing a typo in your remote URL collboration ==> collaboration. So, correct URL that should be added as a remote is:
https://github.com/udacity/course-collaboration-travel-plans.git
# Remove previously incorrect remote
$ git remote rm upstream
# Adding correct remote
$ git remote add upstream https://github.com/udacity/course-collaboration-travel-plans.git
Hope it helps.

Related

How to push a new code to an existing git repository in github

I need to push my modified new java code to my old git repository in github but I do not have old code in my pc. How to do that?
I had push a code before my github account before. Now I don't have that old code in my pc. How do I pull the project into my pc and after making changes, push again to the same repository?
I do not have much experience in github, so please help me to improve skills on github.
Check your remote first to see where it is pointing to by
$ git remote -v
origin ssh://git#<old-git-url>/<project>.git (fetch)
origin ssh://git#g<old-git-url>/<project>.git (push)
Change the pointing to GitHub
$ git remote set-url origin ssh://git#<github-url>/<project>.git
Now your repo is pointing to Github
Now you can make your changes and then add them and do a commit and finally push to remote branch; say you are on master.
git add <file>
git commit -m <commit message>
git push origin master
I had to do just that and achieved it like this.
Setup. I assume you have a new remote repository with files that may not cause a conflict with the directory you currently have locally.
Git clone from the git repository you need to push to. Just make sure you create a new directory for the cloned code.
Copy the contents of the cloned repository into the local directory that has your current code. Make sure to copy the .git (hidden) file.
cd into your local directory and run git remote -v. You should see the remote repository git address.
git add -A to add whatever change you require and commit it.
Finally git push
You need to make sure that your local repository (the one that is on your computer) is connected to the remote repository (the one that is on the GitHub servers).
After this, you need to add the modified file to the staging area. Say, you have a file test.txt that you have modified, you would add it to the staging area by typing
git add test.txt
After that you would need to commit those changes. You can do that by
git commit -m "commit message"
And that's it, you have now saved those changes and recorded them in the version control. But the changes that you made have only been recorded in your local repository and you would need to push these changes to the remote repository (the GitHub servers). You can do this by
git push origin master
It would take a few seconds (depending on your internet speed and the project file size) to push these changes to the remote servers. Once it's done, you can open that repository on GitHub and see the changes for yourself.
Just to amend this a bit. I believe "master" is now "main" in some instances or platforms. If this answer isn't working for you, try swapping that out. It worked for me.

something went wrong when pushing to github with webstorm

As is shown in the image,I'm not sure if the failure is caused by some missing property while setting up webstorm .
The issue is not resolved after a lot of efforts.As a learner,I don't know what to do now.
Meanwhile,something seems wrong as shown in git bash.I've no idea whether the two are directly related.
If you have ever faced these difficulties,could you please give me some idea? Even if it's only a web address.
What I want to do is only pushing my code. Anyone who pushed successfully in any other way will be welcomed to share your method.
If I'm being honest I'm not sure that I completely understand your question, but I will supply some information that will hopefully lead you down the right track.
First in the bash shell, cd (change directory) into your project directory like this:
$ cd /c/foo/bar/yourprojectfolder
In your project top most directory, do you have a .git folder? You may have to show hidden folders in windows to see this directory. If not, you need to initialize a repository with the init command.
$ git init
Initialized empty Git repository in C:/foo/bar/yourprojectfolder/.git/
After running this command, you should see a .git folder inside of the directory you changed to (used cd to get to) earlier.
Next, in order to push, you first need a remote repository to push to. Based on your first picture, I believe that you have successfully created a repository on GitHub. If not however, just log into GitHub and click the 'New Repository' button:
Once a repo has been created, you need to add it as a remote to your local git (in git bash). To do this you need a url (either SSH or HTTPS) to your repo. You can find this url inside of your repository in online GitHub. If you are not certain you have set up SSH, it's best to use the HTTPS url. It should look something like this, but the url itself will be different and specific to your repository:
Copy that url to your clipboard, and then back in git bash run:
$ git remote add origin <PASTE YOUR URL HERE>
You need to make an initial commit of your code to have something to push:
$ git add .
$ git commit -m "Initial commit"
Finally, with the origin repo set up and a commit made, you should be able to push to your origin repo
$ git push -u origin master
You should now be able to view your code on GitHub.

Git push not working but "git clone" and SSH does

I set up a Debian server that uses SSH for shell access and git repos. I created a bare repo on it and using ssh was able to clone it to my Windows 8 workstation, however when trying to push changes back to the Debian server I get the error depicted here:
Read from remote host 174.52.5.192: Connection reset by peer
fatal: sha1 file '<stdout>' write error: invalid argument
fatal: The remote end hung up unexpectedly
error: failed to push some refs to 'git#174.52.5.192:/home/git/repos/space-junk.git/'
I use this work station regularly for shell access to the same server via SSH so I know inability to access SSH isn't the problem.
Does anyone have any idea what's going wrong?
Actually, the first push should be:
git push -u origin master
That will link the local branch master to its remote tracking one origin/master
Then, after that first push, you will be able (for all the subsequent push) to do a simple:
git push
See more at "Why do I need to explicitly push a new branch?".
I got it working! It turns out the proper command was
git push origin master
The Windows version didn't have a descriptive enough error message but I got it working by switching over to Linux, which told me my command was wrong.

error: RPC failed; result=22, HTTP code = 400

I am trying to push my app on to Heroku, but I am getting this error message. I have looked around, someone mentioned about GitHub recently started redirecting http repository access to https and it appears your git is unhappy about this change. But I am having troubles pushing to heroku, any help will be much appreciated.
error: RPC failed; result=22, HTTP code = 400
This may occur due the reason that Heroku's Git doesn't understand shallow clone as mentioned here.
Workaround is to disable shallow clone before deployment.
git fetch --unshallow
change your postbuffer
git config --global http.postBuffer 52428800
then you postbuffer is 50M .
i hope this is not coming to late, but Heroku deployments require a full Git clone. By default, Pipelines clones your repository with a depth of 50 to shorten your build time. You can configure your Pipeline to do a full Git clone in your bitbucket-pipelines.yml file.
try adding full clone depth to your yml file
image: node:6
clone:
depth: full
It could be a glitch, as I mentioned in here.
(Actually, right as I write this, GitHub is having a "Major service outage"!)
Make sure you can reproduce the issue with an http or an https url.
If that persists, simply try and swith to an ssh url
git remote set-url heroku git#heroku.com:yourRepo
(which is the recommended approach, since heroku normally support ssh only)
The problem (could be) that you are probably used git clone --depth .. for your repository and that created so called shallow copy (without history).
If you cloned somebody else repository (!), just delete /.git folder and create a recreate repository as new with
cd <my-project>/
git init
Then you can push even with remote https://<youprojectname>.herokuapp.com/
For Rails 4: make sure you add "rails_12factor" gem to your Gemfile.

Can't push branch to github "Use git#github.com:Paratron/spacebattles.git"

I have a working branch in my Mac names database and I would like to push this branch to GitHub and have tried to do this by running:
git push -u origin database
And get the following error message:
You can't push to git://github.com/Paratron/spacebattles.git
Use git#github.com:Paratron/spacebattles.git
Are there known issues that could be the cause for this?
Are there any likely errors I could be doing that results in this error?
Like it says, you can't push to git://github.com/Paratron/spacebattles.git (because it's a read-only URL). Try this:
git remote set-url origin git#github.com:Paratron/spacebattles.git
git push -u origin database
If you haven't ever used git in this way, you need to set it up to work with GitHub first: http://help.github.com/mac-set-up-git/
Also, are you Paratron? If not, you'll need to fork his repository first: http://help.github.com/fork-a-repo/. Then you'll need to use your username instead (git#github.com:YOUR_USERNAME/spacebattles.git).
The URL that you have set for the repository is a readonly URL. You'll need to change the URL for the remote, using remote set-url:
git remote set-url origin git#github.com:Paratron/spacebattles.git

Resources