How do I upload files to source? - file-upload

I've switched to windows and am having a hard time using bitbucket with it.
Within the downloads menu you can add files but this is not added to source.
I've also tried using source tree (web application) but when I attempt to push the files they do not exist in my directory. Any idea how I can do this or a guide which explains how to upload files. It's been a number of years since I have used bitbucket on windows.

Bitbucket is simply a git provider. You'll have to use Git commands (or a GUI like Sourcetree, Gitkraken, etc.) to push (upload) your files to source.
A basic guide to working with Git can be found here.

Windows or Linux only you need a git console or git cli installed in your default cli.
First clone your repository to your local system. Go to your
bitbucket account and your repository need to be file uploaded. Copy
the git url command. Open git console and type the following command.
git clone "git URL"
Explore you repository and make changes. Like add file which you want to upload to it.
Go to your git console again and type the following commands.
git add .
git commit -m "commit message like - adding file"
git push origin master

Related

first time check in my pycharm project to Git

I have written whole code before cloning any repo, now I decided to push entire code into new repo directly from pycharm IDE.
Do anyone know how to do that.
If you want to push the project to GitHub, just use VCS - Import into Version control - Share on GitHub.
If you want to push somewhere else, then:
Use VCS - Enable VCS integration. If there is no git repository in
the project, IDE will create one.
Mark all files you need, add them to git and commit
Add a remote using VCS - Git - Remotes
Push (VCS - Git - Push, or Ctrl+Shift+K)
first check your remote by git remote -v
add remote of new repo while creating repo you will get.
git remote add origin
git init
git add .
git commit -m "first initialize"
git push origin master

Branch my own repo in a separate folder - GitHub for Windows

I need to work on different branches of a project at the same time, so having multiple folders (one for each branch) would be the faster and easier solution.
The problem arises when cloning my own repo: GitHub for Windows will recognize it and automatically move it to the main repository, where i can manage only one branch at a time.
I'm new to GitHub and couldn't find any working solution/workaround for version 1.2.110
Already tried, didn't work:
Github: how to checkout my own repository
Clone Github repo to specific Windows folder?
https://stackoverflow.com/a/7803102/1193335
http://bitdrift.com/post/4534738938/fork-your-own-project-on-github
1 Create a new folder, eg: C:\GitHub\mynewbranch
2 Drag it into GitHub, fill the description fields, uncheck "Push to GitHub" and continue.
3 Open your "Repository settings":
And fill the "Primary remote (origin)" field with your repository url:
4 Click "Open in Git Shell" (below "Repository settings") and type this in the command line:
git remote set-url origin git#github.com:<username>/<repository name>.git
5 Then this:
git pull origin <branch name>
6 Switch to the desired branch in GitHub, enjoy :-)
P.S. to update future changes from the master:
git pull origin master

Capistrano, Git, and Rails. (Reset hard head)

So I had been (stupidly) making changes directly on the live server instead of making them on my local machine and deploying them. This messed up my deployment. So now I was to do "git reset --hard".
On my remote server I have a project.git directory (for the repository... which is bare btw) and a project directory (for my actual application).
But when I try to run "git reset --hard" it tells me I'm not on a working tree. If I go into config and change bare to false... it says the same thing.
Ideas?
Found a better solution. :)
First I did a git reset --hard on the local server (since the remote server is just a bare repository.)
Then I did a git commit -a which told me there were no changes but that there were untracked files.
So I did a git add . to add all the files that weren't being tracked.
Finally I ran git commit -a again and git push.
This updated my repository with all the new files and then cap deploy functioned as expected.

"Bare" git repository: how can I let Apache always "see" the latest commit?

We've got a "bare" git repository on a server, for a Web portal project. Several programmers, designers, etc... perform dozens of push and pull from/to it.
Now we want to test the project on the server itself, and always test the last commit through an Apache web server which is installed on the same machine the "bare" git repository is stored in.
How can we 'unbare' the repository, and let the working directory contain always and only the last commit deriving from the last push?
Or anything else aiming to achieve the same result?
You can use a post-receive hook to do a git pull inside your webserver document root/repository.
in your bare repository
do
mv hooks/post-receive.sample hooks/post-receive
chmod +x .git/hooks/post-receive
the post receive should be something like
#!/bin/sh
WEB_ROOT='/var/www/project'
cd $WEB_ROOT
git pull
A more elegant solution that doesn't involve that the web server area being a git repository, you can also review the git documentation about hooks
Note: if you use the simple solution, please make sure that your webserver doesn't serve the .git directory, this would give some hackers/crackers the access to the website source code!

How to update my server files from a git repo automatically everyday

I am a noob in these server related work. I am writing some PHP code in my local system and has been updating my repo in github regularly. Each time I want to test my application, I copy all the files from my local system onto my server through FTP and then do it. Now I want to know whether is there a way to automatically make the commits that I make to reflect in the files in the server. Is there a way to automatically make the server get the files from the repo periodically? (say, once everyday).
Can this be done other way, like when I make a push from my local machine, the repo gets updated and in turn the files on the server also get updated?
My Server Details: Apache 2.2.15, Architecture i686 with Linux Kernel 2.6.18-194.32.1.el5
In addition to cronjobs, you can use a post-receive hook: http://help.github.com/post-receive-hooks/
If you have cronjobs you can use them. First set up the repository on your server. Then you can set up the cronjob, choose a time in which it should be executed, and then in the cronjob execute the following command:
cd your/repository/folder; git pull master origin
Perhaps explore the git archive command, which you can use to get a zip file or similar of your code. You could then perhaps use a script to copy that to your (other) server?
git archive --format=zip --output=./src.zip HEAD
will create a zip file called src.zip from the HEAD of your repo
More info:
http://www.kernel.org/pub/software/scm/git/docs/git-archive.html
Do a "git export" (like "svn export")?