I've created a new project, and I'm trying to add an entire directory to it. I've init'd git in the top directory, added the subdirectory, created a README with content, committed, done the 'git config' steps (user.name, user.email), added the remote. ~/.git/config is identical (save repo name) as that for another project.
When I do a 'git push -u origin master' the command line response tells me everything is up to date. When I go to look at the web instance, though, no files tab is visible.
In addition, I just created a new local repo, and did a git pull. The 2 directories were pulled over, but are empty.
I'm new (obviously) to managing a gitlab repo. I'd like to learn what I'm doing wrong, and how to accomplish what I need (a reliable repo for multiple projects). Right now, I'm fairly confused.
Related
I am new to GitHub and having issues uploading a website.....
When I upload to GitHub, it separates folders (Here is the image of what I am seeing GitHub) and thus website doesn't display properly.
Here is the image of the file on my computer Here is what I am seeing on computer
I attached screenshots, any help would be great....
I am confused af at this point in time
Try To push changes correctly as it doesn't happen usually. Read this:
Open your Command prompt first then move to the particular which here contains your whole website.
Start with
git init (it will initialize your folder to be pushed up or pulled
to git Controls)
then git add . (To add All the files create your
.gitignore file carefully)
git commit -m "Whatever you want to write
us a note about the changes"
then git push -u origin main
Hope Your problem will be solved or maybe something you can only diagnose because you are there sitting and functioning
**Note If there is any folder containing called .git, delete that. Before proceeding the way I mentioned **
I have a repository for a website and it has two separate remotes. One is for the website files and one for datasets and R scripts to make some data in my blog posts reproducible and archived for the future.
My local file structure looks like this.
-Website
|
|--website-files/posts/blog-post1
|/blog-post2
|r_script.R
The folder Website has two remotes one - origin - for the website, and one - blog-post - for the dumping ground for my replication files.
So, because I have cleanly added a second remote, I tried to add the file r_script.R and push it to the remote blog-post.
git add website-files/posts/r_script.R
Then, though, when I check the status, git status shows the file name as untracked listed as
../../r_script.R
The precise question: How do I add a file in a subfolder to be tracked and then to push its own unique remote? Note, when I copy r_script.R to the folder Website, and run git add r_script.R it shows up as a staged file ready for committing.
But I would really rather keep it in the subfolder to keep it clean.
Maybe should I add the repo blog-post as a submodule to the subfolder website-files/posts/ or something like that?
I am using GitHub desktop application on my local machine and when I create and complete my repository(web directory)on my local machine, then I push it GitHub online through desktop application. But here is my problem:
Sometimes it doesn't pick and push all of the files/folders from my local repository, it only pick 3 files, while my repository has 5 folders and one inex.html file.
And sometimes it works perfectly fine. I never understand where is my problem. Any thoughts on this?
Do a git status before your push, as well as a git show HEAD to check the content of your last commit.
That way, you will see if there remain some files not added to the index or not committed.
And you will see if every files you wanted is in a commit.
If one file is consistently ignored, see if it is actually ignored by Git with:
git check-ignored -v -- a/file
I am about to throw my laptop through a wall, and am hoping for help before reaching that point. For reference, I am following these instructions exactly - https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/.
I have a directory ".../path/thisdir". Inside of thisdir are (1) a file called Demo.R and (2) a directory called sportVU. sportVU is a directory with ~15 files in it.
When I follow the instructions in that link, my github repo looks like this:
https://github.com/NicholasCanova/packageSportVU
Notice that the sportVU directory link cannot be clicked in github, and when I download the repo, sportVU is an empty folder. Why is this happening? This shouldn't be so tough.
EDIT: this is what the repo looks like in my local machine, I'm 100% sure it's not empty:
It could be that you have two .git folder in your directory. View hidden folders to see.
Similar questions:
What does a grey icon in remote GitHub mean
Why can I not open my folder in GitHub?
Since Git doesn't store empty folders the steps you should follow exactly are:
Delete the old repo and start again following exactly my steps.
git clone <repo url>
Inside the folder of the cloned repo create a directory manually and name it as you want i.e sportVU.
Drag and Drop all the files you want in the sportVU direcrory.
cd to Myrepo/sportVU and type git add *
type git commit -m "added some files"
git push -u origin master.
and you should be all set
My Setup: I do the local commits in Eclipse IDE itself. My local repositories resides within the workspace as well.
Somehow I couldn't do remote commits using Eclipse so I just did, thus I've been using git bash to do remote commits to codespaces.com
git remote add origin git#codespaces.com:acct_name/repo_name
git push origin master
This has served me well so far.
Now I created another repository, let's say repo_foo.
For this repository, I want to place multiple directories(projects) inside it. I don't really need the codespaces Projects here.
I just want to be able to do this.
git remote add origin git#codespaces.com:acct_name/repo_foo/proj_1
(currently this gives no repository in path error)
So the repo structure should looks like this.
repo_foo
- proj_1
-src
- proj_2
-src
-lib
etc.
Any ideas for this?
Now I created another repository,let's say repo_foo. For this repository, I want to place multiple directories (projects) inside it.
I dont really need the codespaces "Projects" here. I just want to be
able to do this.
So you want to have nested git repositories in other git repositories? It’s unclear what your final goal is. Perhaps git submodules would serve your needs? Submodules are basically other repositories cloned into another git repository. So let’s say you have a main project, but you also have a repo for a great library you want to use. You can add the library as a submodule & refer it to the main project. That way if you make changes to the library, the projects that have that library as a submodule can be automagically updated. Quite powerful concept if you need that.
The problem from my perspective is you are convolving the concept of a directory & a repository into one thing. So when you do the following:
git remote add origin git#codespaces.com:acct_name/repo_foo/proj_1
You are saying, “Go into this repo. And create another repo in that repo.”
There will be no origin of git#codespaces.com:acct_name/repo_foo/proj_1 since the parent repo of git#codespaces.com:acct_name/repo_foo already exists.
What you need to do is setup a repo for each project & decide on a naming scheme. Something like:
repo_foo_proj_1
repo_foo_proj_2
etc…
And your git remote add origin command would be:
git remote add origin git#codespaces.com:acct_name/repo_foo_proj_1
git remote add origin git#codespaces.com:acct_name/repo_foo_proj_2
etc…
When you initialize git in a folder, all the sub folders are auto tracked. When working with multiple projects or folders, where each should be tracked independently. You should keep them at the same level.
--home
--Workspace
--project1
--project2
--project3
In case you initialize git accidently at workspace, when you check git status, it includes all the the files and folders underneath to be tracked. When you perform git remote add origin, config file under .git/config is added with a remote url which is used for push and pull operations. So if you initialize repo_foo and provide the remote add, you cannot perform the same actions under proj_1. It's automatically being tracked and all the push/pull operations will use the path present in repo_foo/.git/config file.