Cannot check out new branch because of invalid path? - windows

I'm trying to clone a repo to my computer. I do the standard
git clone [link to bitbucket repo]
and then call
git branch -a
to see my remote branches, which shows
remotes/origin/develop
which is the branch I want to checkout into. However, when I type
git checkout develop
I get an error that says
error: invalid path '.\api-log\api.log'
and it fails to create the local develop branch. Is this happening because there is something wrong with the file? If so, how can I fix/remove the file so that the clone will go through? All the work is in the develop branch and nothing in the master.
I'm using Windows.
Apologies if this has been answered before but I couldn't find anything.

I don't know exactly why this happen but I suggest you to remove the offending file from the repository history by the wonderful BFG tool.
At this url https://rtyley.github.io/bfg-repo-cleaner/ you can get the software and the documentation.

Related

Trouble setting up a laravel instance across servers using git

I am struggling with properly configuring a git workflow for a laravel project. I created the laravel project locally. At the base directory I used the git init command. Then connected the repository to the bitbucket repository set up by the company I am working for like so:
git remote add origin https://address/xyz.git
I then made some new changes to a few of the files. Did a commit and then pushed to origin like this:
git push -u origin master
Now I logged into our development box (which is not my local dev box). Built the laravel default laravel application and then tried to pull down the project specific files by connected the dev box's laravel directory to the same repository, but I keep getting the following error:
error: The following untracked working tree files would be overwritten by checkout:
.gitignore
composer.json
package.json
resources/js/app.js
resources/js/bootstrap.js
webpack.mix.js
Please move or remove them before you can switch branches.
I know I probably missed some simple step or did not set up the development box correctly, but I can't find this scenario in the documentation and I can't seem to discover what I did wrong. Can anyone help?
It sounds like the repository on the main development box has some local changes that are not checked into git. Run the command
git status
On the remote development box. This will tell you any local changes.
If you want to remove any local unchecked in changes you can type
git reset --hard (resets any tracked files)
git clean -Xdf (resets all untracked files)
If you want to preserve any local changes, you can type
git stash
git stash --pop (recovers the changes - this may induce some conflicts)
Thanks for listing those tools Ben W, but it turns out that I the wording of my question was deceptive. When I went to the second machine (the development box), I should have built the laravel instance by using the git clone command.
git clone https://address/xyz.git
What I did instead, was build another full instance of laravel and try to link it to the same repository I created from the first box (my local notebook).
I upvoted your answer anyhow Brad W. because those are all great tools to know. Thanks.

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.

Github Windows: New branch created from command line not showing up on github.com

I created 2 new branches using the command line, and when I use the command 'git branch' I can see all of my branches in the window, but when I used the command 'git push' I get a message that says, "nothing to commit, working directory clean' and so I'm not seeing my new branches on github.com.
Can anyone shed some light?
Thanks!
Robin
Have you tried git push origin my_new_branch?
The below command will work:
git push origin devbranch
After running the above command git push origin dev I got this error "remote: Repository not found."
I had a similar error in which i created and published a branch on one computer. But on another It wouldnt add the branch automatically (even though the git server had the new branch). I simply did a pull from shell rather than using the app's sync function. once I did the git pull then it added the new branch and was able to be selected from the gui.
I assume this is a bug

Github and Heroku Cloning error - invalid path/syntax error

Here is my problem
I am using heroku to develop an app and I am using github along with it for a project.
Now when I try and use github(clone) without heroku to work on a different project it says...
michael#michael-HP-PavilionNotebook-PC:~$
michael#michael-HP-PavilionNotebook-PC:~$
michael#michael-HP-PavilionNotebook-PC:~$ git init
Initialized empty Git repository in /home/michael/.git/
michael#michael-HP-PavilionNotebook-PC:~$ ls
Desktop Downloads gifiniti Music Pictures Templates Ubuntu One
Documents examples.desktop gifinitiApr24 oldgifiniti Public tmp Videos
michael#michael-HP-PavilionNotebook-PC:~$ git clone git#github.com:toadiferus/SecretTunnel
Cloning into SecretTunnel...
! Invalid path.
! Syntax is: git#heroku.com:<app>.git where <app> is your app's name.
fatal: The remote end hung up unexpectedly
michael#michael-HP-Pavilion-dv6700-Notebook-PC:~$
How would I resolve this error? Can't find any support online for this specific problem.
HOw can I change the syntax of the commands? I want to just clone a project from github not heroku.
THANKS!
Michael
Your ~/.ssh/config may have been hijacked by if you used the heroku accounts plugin. Same thing happened to me. I removed the contents of my ssh config and all is well!
Firstly, you don't need to init before you clone - init is used to turn a project folder into a git repository unless you really intended to turn your entire user directory into a git repo? I would suggest you delete the .git folder that would have been created from your doing this.
To be sure you're using the correct path go to your projects on github and use the icon that looks like a clipboard to copy the correct url to your clipboard, paste onto your command line and see what happens then.
I also don't understand why when you do a
git clone git#github.com:toadiferus/SecretTunnel
Cloning into SecretTunnel...
you get what looks like a Heroku push error??? Git clone from a github URL should simply clone the project from github to your local machine.
! Invalid path.
! Syntax is: git#heroku.com:<app>.git where <app> is your app's name.
Are you editing the output you are pasting?
The git url should have .git on the end, ie. git#github.com:toadiferus/SecretTunnel.git.

How to pull and check-out remote Git repository

OK, total noob question, for msysgit on Windows 7, but I have a remote repository (on unfuddle), create on one PC, and now I want to pull it down to another PC. I tried 'Fetch' using Git Gui, but the folder still only has a .git subfolder. It took a while pulling it down, so I assume there is something in the repo, but how do I check it out to a working copy. Nothing I have tried seems to work.
SOLUTION:
It's not directly in his answer, but VonC below pointed me to the unfuddle help documentation for Git, which is as terse as the Git man-pages are dense. The follwing single command got me the working copy and local repository I needed:
$ git clone git#subdomain.unfuddle.com:subdomain/abbreviation.git
Following the Git documentation on Unfuddle, did you declare your unfunddle repo as a remote?
$ cd /path/to/repository
$ git remote add unfuddle git#subdomain.unfuddle.com:subdomain/abbreviation.git
Try also gitk --all: if the fetch has succeded, you should the remote tracking branches (like unfuddle/master). You can then merge it to your master branch in order to finally see files in your (still empty) working tree.
You could also have done a git pull to combine the two steps together (fetch+merge). See this blog post for illustration.
Actually, the OP ProfK reports a cloning issue:
I did already have the unfuddle remote added
git clone git#subdomain.unfuddle.com:subdomain/abbreviation.git
is more suited to get a local repo with the right remote already added to it.

Resources